Search code examples
plotvegan

How change the y-axis numbers to be horizontal on an NMDS plot created in vegan?


Can I change the y-axis numbers to be horizontal on an NMDS plot created in vegan?

library(vegan)
sp <- poop[,28:34]
bat <- poop[,4:7] 
mds1 <- metaMDS(sp, k=3,try=200)

plot(mds1$points[,1], mds1$points[,2], pch = as.numeric(bat$species),
 col= as.numeric(bat$species),
 xlab = "NMDS1", ylab= "NMDS2")

NMDS plot


Solution

  • In R, the direction of labels is controlled by graphical parameter las (see ?par). You can also give this parameter in plot call for the metaMDS result. As you see from ?par, las=1 will put all labels horizontal.

    More seriously, you should not plot metaMDS results like you do. It is better to use the dedicated plot method for the result, or if you want to do it all by yourself, you should at least force equal aspect ratio for axes with asp = 1 in your plot call. So the following should work:

    ## with metaMDS plot:
    plot(mds1, display="si", las=1, type = "n") # for an empty plot
    points(mds1, pch = as.numeric(bat$species), col= as.numeric(bat$species))
    ## or with generic plot:
    plot(mds1$points[,1], mds1$points[,2], pch = as.numeric(bat$species),
    col= as.numeric(bat$species),
    xlab = "NMDS1", ylab= "NMDS2",
    asp = 1, las = 1) # this is new