Closed deltoroi closed 2 years ago
No answer to this question?
Apologies @deltoroi & @jammah for not circling back to this... too many packages, too little time.
The geom
argument takes "points"
or "text"
, but I suspect you want the points and the labels. In which case that is not offered in these autoplot
methods, but it is relatively straightforward to do this yourself using geoms from the ggrepel package:
library("vegan")
library("ggvegan")
library("dplyr")
library("ggrepel")
data(varespec)
# with the development version of vegan
set.seed(23)
sol <- metaMDS(varespec, dist = "hellinger", autotransform = FALSE)
# if using the CRAN version of vegan
# set.seed(23)
# sol <- metaMDS(decostand(varespec, method = "hellinger"), dist = "euclidean")
scrs <- fortify(sol)
ggplot(data = scrs, aes(x = NMDS1, y = NMDS2)) +
geom_point(aes(colour = Score, shape = Score)) +
geom_text_repel(mapping = aes(label = Label), max.overlaps = 20, seed = 34) +
coord_equal()
You could do this with plain old geom_label
or geom_text
by setting the nudge_x
and nudge_y
arguments but ggrepel takes care of overlapping labels which is likely to occur with these kinds of ordinations.
Many thanks @gavinsimpson
Hello, I just used ggvegan to plot a NMDS. Two questions:
Is there an argument that will allow the site and species names to be labeled? Is there a way to plot ellipses on this ordination plot?