Search code examples
rvegan

using ordiellipse in NMDS in R on axes 2 and 3


I am trying to apply NMDS by vegan package on a dataset by the following functions:

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)

However, despite a this biplot is constructed on axes 2 and 3, the ordiellipse function write the ellipses which identify clusters on the axes 1 and 2 biplot. Could anyone explain me why this happens and how could I plot the right ellipses on axes 2 and 3 biplot?


Solution

  • You could use the alternative plot function 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)