Description Usage Arguments Value Examples
This function uses a vegan ordination object (e.g. from metaMDS) and a valid metadata table with Factor1 and Factor2 and is meant to be used in conjunction with CMETNGS::ordin_annotate.
1 | ordin_legend(metadata, location = "bottomleft")
|
metadata |
a valid CMET metadata object, containing minimally the sample names, Factor1 and Factor2. |
location |
where to put the legend on the plot, defaults to "bottomleft" |
A list with the colvector and pchvector
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Short example
# Load precomputed example data
library(vegan)
data(dune)
dune.dis <- vegdist(wisconsin(dune))
dune.mds <- cmdscale(dune.dis, eig = TRUE)
#create completely made-up metadata for dune
dune.md <- data.frame(Factor1=c(rep("Dune1",nrow(dune)/2),
rep("Dune2",nrow(dune)/2)),Factor2=c(rep("Grass",7),rep("Shrub",7),
rep("Tree",6)))
veclist <- ordin_annotate(dune.mds,dune.md)
dune.mds$species <- wascores(dune.mds$points, dune, expand = TRUE)
pl <- ordiplot(dune.mds, type = "none")
points(pl, "sites", pch=veclist$pchvect, col=veclist$colvect, bg="yellow")
ordipointlabel(dune.mds,display = "sites",add=TRUE)
ordin_legend(dune.md,location="topright")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.