ordin_annotatedplot: Create an annotated ordination graph

Description Usage Arguments Value Examples

View source: R/ordin_annotatedplot.R

Description

This function is a wrapper around CMETNGS::ordin_annotate and CMETNGS::ordin_legend: it uses a vegan ordination object (e.g. from metaMDS) and a valid metadata table with Factor1 and Factor2 to create an annotated plot.

Usage

1
2
3
4
5
6
7
ordin_annotatedplot(
  ordinobj,
  metadata,
  location = "bottomleft",
  addLabels = TRUE,
  addLegend = TRUE
)

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.

location

where to put the legend on the plot, defaults to "bottomleft"

addLabels

wether or not to add sample labels to the ordination ( defaults to TRUE)

addLegend

a logical, indicating wether or not to add a legend to the plot. Defaults to TRUE.

Value

A list with the colvector and pchvector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)))
ordin_annotatedplot(dune.mds,dune.md)

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