ordin_annotate: Create color and shape annotation for base vegan ordination...

Description Usage Arguments Value Examples

View source: R/ordin_annotate.R

Description

This function uses a vegan ordination object (e.g. from metaMDS) and a valid metadata table with Factor1 and Factor2 and returns a list with colvect and pchvect. The colvect supports at maximum 9 levels of Factor 1 ( otherwise only 1 color (#E41A1C) is returned). The pchvect supports at maximum 5 levels of Factor 1 (otherwise only 1 shape, 15 (filled square)) is retured.

Usage

1
ordin_annotate(ordinobj, metadata)

Arguments

ordinobj

a vegan-created ordination object (i.e. ordinobj$points must exist)

metadata

a valid CMET metadata object, containing minimally the sample names, Factor1 and Factor2.

Value

A list with the colvector and pchvector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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")

CMET-UGent/CMETNGS documentation built on Dec. 12, 2020, 8:22 a.m.