我正在尝试通过以下功能在数据集中应用vegan软件包的NMDS:
library(vegan)
library(MASS)
library(MVA)
library(ggplot2)
all_d <- vegdist(landmetr, method= "hor", binary=FALSE, diag=TRUE,
upper=FALSE, na.rm = FALSE)
allmds3 <- isoMDS(all_d, k=3)
gr0 <- factor(france100_7c$LAND_CODE)
plot(allmds3$points[,2:3], col=gr0, bg="grey", cex=0.2,pch=20)
# regress environmental variables on configuration of site points
provaenv3 <- envfit(allmds3$points[,2:3], landmetr,999, na.rm = FALSE, france100_7c$LAND_CODE)
# add the environmental regressions to the area plot
plot(provaenv3,add=T, cex=0.5)
#plot0
ordiellipse (allmds3, gr0, kind = "sd", conf=0.95, label = T)
但是,尽管在轴2和3上构建了这个双图,但是ordiellipse函数仍写了椭圆,该椭圆标识了在轴1和2上的双图。
谁能解释我为什么会这样,我如何在第2轴和第3轴双轴绘图上绘制正确的椭圆?
最佳答案
您可以使用替代绘图功能ordiplot()
:
require(vegan)
data(dune)
data(dune.env)
NMDS <- metaMDS(dune, k = 3)
pl<-ordiplot(NMDS, choices = c(2, 3), display = 'sites', type = 'n')
points(pl, what = 'sites', col = dune.env$Management, pch = 16)
ordiellipse(pl, dune.env$Management)