I created a Detrended correspondence analysis (DCA) displaying the species using the script below but I'm wanting to add the sites to it. I know I can do this with the simple script of: plot(vare.dca)
, but not sure how I do this once I have improved the graphics. I'm new to R so apologises if this is a very simple question. Many thanks for any help!
bugs<-read.csv(file= "bugs.csv", row.names='Sites', sep=",", header=TRUE)
env<-read.csv(file= "envir.csv", row.names='Sites', sep=",", header=TRUE)
library(vegan)
shnam <- make.cepnames(names(bugs)) # abbreviate Latin names
identify(pl, "sp", labels=shnam)
plot(vare.dca, dis="sp", type="n")
sel <- orditorp (vare.dca, dis="species", lab=shnam, pcol = "grey", pch="+")
The data for 'bugs' and 'env' are here: https://gist.github.com/anonymous/dcf0fad859eb879014b2
The general way is to use the points()
methods, as in
points(vare.dca, display = "sites", col = "red")
or use the text()
method if you want the site/sample labels.
orditorp()
can also be used, just change the argument to display = "sites"
, which you could have ascertained by reading ?orditorp
.
There are a number of other options, most notably ordipointlabel()
which will work harder to stop overlap of various labels.
I've written a number of blog posts on these functions in vegan, which you can consult for more explanation and examples