I’ve produced an ordination plot from a data frame in R. The data frame consists of species (columns) by sites (rows). There is a group of “treated” sites and a group of control sites within the matrix. However, the way I computed the ordination requires no other variables in the matrix (i.e. no explicit identifier saying that a site is “treated or not”. The question: can I label the points in the graph by group without constructing a classification variable? or, can I give the treatment rows (e.g. rows 1:7 one type of symbol and the control (e.g. 8:14) another type?
Here’s an example:
#guess i don't have the reputation to post images...hmmm...
#looks something like this (first column is the site)
# spec1 spec2 spec3...spec14
# 1 0 1 0 ... 2
# 2 1 5 0 ... 0
# 3 0 2 1 ... 0
# .
# .
# .
# 14
# vegan package
library(vegan)
# example data matrix is 14x14, species names across columns, sites are numbered automatically upon import of txt file into RStudio
data(example)
#vegdist creates a distance matrix of sites
example.dis <- vegdist(example)
#monoMDS computes ordination of distance matrix
example.mds <- monoMDS(example.dis)
#plot it
here’s where i think i can modify the graph, but I’m not sure how to do it
plot(example.mds)
Yes you can use an external variable to specify for example the color of points.
Here is an example: