使用以下数据框:
df<-data.frame("sites"=as.character(1:20),"type"=c(rep("small",10),rep("large",10)))
sites type
1 1 small
2 2 small
3 3 small
4 4 small
5 5 small
6 6 small
7 7 small
8 8 small
9 9 small
10 10 small
11 11 large
12 12 large
13 13 large
14 14 large
15 15 large
16 16 large
17 17 large
18 18 large
19 19 large
20 20 large
我想在以下排序图中按标签(即“小”、“大”)为文本标签(即 1-20)着色:
library(vegan)
library(stats)
data(dune)
dist <- vegdist(wisconsin(dune))
#Ordinate data
pc<-cmdscale(dist, k=10, eig=TRUE, add=TRUE, x.ret =TRUE)
#Create ordination plot
quartz(title="PCoA on coral data")
fig<-ordiplot(scores(pc)[,c(1,2)], type="t", main="PCoA")