0

I'm generating NMDS ordination plots from community data using the R package, vegan, and want to include vectors (ie arrows from the origin) whose lengths correspond to the importance of selected species. How can I limit the arrows displayed to only those species, say, in the top quartile of the data? I can calculate the lengths for each vector, but don't know how to limit the arrows printed to those that meet the desired standard. For example,

require(vegan)

data(dune) mds <- metaMDS(dune) plot(mds$points[,1], mds$point[,2]) arrows(0, 0, mds$species[,1], mds$species[,2], col = "grey50")

# for the length of ea arrow for ea sp:

hyp <- sqrt(mds$species[,1]^2 + mds$species[,2]^2)

Thanks...

Peter Nelson
  • 85
  • 1
  • 2
  • 7
  • (1) You should always use `asp = 1` in ordination plots. This is done automatically if you use vegan functions and issue `plot(mds, dis="site")`, but if you want to use more cumbersome code of your own, add `asp = 1`. (2) It's much easier to use `hyp <- sqrt(rowSums(scores(mds, dis="sp")^2))`. (3) vegan `plot`, `text` and `points` functions for `metaMDS` result have a `select` argument that can be used like the name indicates. However, it cannot be used for arrows, but I can't understand why would you use arrows for species scores. – Jari Oksanen Feb 22 '17 at 12:27
  • Thank you Jari. I really appreciate the information, asked for and volunteered. As far as arrows for species scores--you're right: Misleading at best. I was trying to satisfy a colleague even less informed than me. Glad you made me think about it. – Peter Nelson Feb 23 '17 at 19:52

1 Answers1

0

The ImportantSpecies line identifies which points are in the top quartile. You can then use that as shown to plot only those points.

ImportantSpecies = which(hyp > quantile(hyp, 0.75)

plot(mds$points[ImportantSpecies,1], mds$point[ImportantSpecies,2]) 
arrows(0, 0, mds$species[ImportantSpecies,1], 
             mds$species[ImportantSpecies,2], col = "grey50")
G5W
  • 36,531
  • 10
  • 47
  • 80