Hello I am running a PCA of some environmental variables. I have a second set of environmental variables that I would like to project passively onto the ordination plot, but with the same arrow length scaling as that used for the first dataset. I used envfit() in vegan for that purpose. To check that I get the same arrow length scaling in plot.envfit() as in plot.cca(), I fitted the same dataset:
require(vegan) data(varechem) pca1<-rda(varechem, scale=T) ef<-envfit(pca1, scale(varechem)) plot(pca1, type="points") sp.sc<-scores(pca1, display="species") ef.sc<-scores(ef, display="vectors") plot(ef, arrow.mul=abs(sp.sc[1,1]/ef.sc[1,1]), col="red") # equivalent to: plot(ef, arrow.mul=vegan:::ordiArrowMul(ef.sc)/vegan:::ordiArrowMul(sp.sc)) The last two lines are the only two ways I managed to get the same length scaling for the plot.cca() "species" and plot.envfit() vectors. However if I want to use another scaling (scaling=1 or 3) for the PCA plot, I can't get similar coordinates for the plot.cca() "species" and plot.envfit() vectors: ef1<-envfit(pca1, scale(varechem), scaling=1) plot(pca1, scaling=1, type="points") sp.sc1<-scores(pca1, scaling=1, display="species") ef.sc1<-scores(ef1, scaling=1, display="vectors") plot(ef1, arrow.mul=abs(sp.sc1[1,1]/ef.sc1[1,1]), col="red") # wrong: the ratio sp.sc/ef.sc varies according to "species" in this case... plot(ef1, arrow.mul=vegan:::ordiArrowMul(ef.sc1)/vegan:::ordiArrowMul(sp.sc1)) # the arrow length scaling varies according to "species". Can somebody tell me what I am doing wrong here? I use R version 3.1.1 (2014-07-10) with vegan_2.0-10 Platform: x86_64-w64-mingw32/x64 (64-bit) Many thanks Arnaud -- View this message in context: http://r-sig-ecology.471788.n2.nabble.com/scaling-issues-with-vegan-s-envfit-tp7579076.html Sent from the r-sig-ecology mailing list archive at Nabble.com. _______________________________________________ R-sig-ecology mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
