Replies: 2 comments
-
Hi did you resolve this? |
Beta Was this translation helpful? Give feedback.
-
Seems to be a long and stale issue. The reason that the I would like to suggest a different selections criterion: now you use axiswise length limit, meaning that the arrows should be within a square. I think it is better to base this test on arrow length, that is, to have arrows within a circle. Get the arrow lengths in 2-dim with splen <- sqrt(rowSums(sum_rda$sp[,1:2]^2)) # your sum_rda object Now to the solution: vegan library(vegan)
## copied from your message
data(varespec, varechem)
ord <- rda(varespec)
## modified from this on: catch the plot structure in pl
pl <- plot(ord, scaling=2, main="Triplot RDA", type="none", xlab=c("RDA1"), ylab=c("RDA2"),
xlim=c(-10,20), ylim=c(-10,10))
splen <- sqrt(rowSums(pl$species^2)) # species distance from the origin in pl[ot]
points(pl, "sites", pch=21, col="black", cex=1.2)
text(pl, "species", select = splen > 0.5, arrow=TRUE, length=0.05) # harmless warning on length argument, but works
## Alternatively you can use magrittr pipes (if you have splen or select vector calculated by other means):
library(magrittr)
plot(ord, scaling=2, main="Triplot RDA", type="none", xlab=c("RDA1"), ylab=c("RDA2"),
xlim=c(-10,20), ylim=c(-10,10)) %>%
points(what="sites", pch=21, col="black", cex=1.2) %>%
text(what="species", select = splen > 0.5, arrow=TRUE, length=0.05) # you need splen for this to work |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm quite new to R and hope somebody can help me. I would like to plot only the top e.g. five species in an RDA figure, as the other species are all overlapping and make the figure messy (see example).
I tried to use: select = abs(sum_rda$sp) > 0.5
However, it doesn't work but also does not show any error message.
Thanks for considering my request
Beta Was this translation helpful? Give feedback.
All reactions