如何更改素食图中的颜色? (嘶叫)

How to change the color in the vegan graph? (bray)

这是我的代码

library(vegan)
library(MASS)


row.names(Data) <- c("SI1", "SII0", "SI0", "SII2", "SI2", "SII1", "SIII0", "SIV2", "SIII2", "SIV1", "SIII1", "SIV0")
bcdist <- vegdist(Data, "bray")

bcmds <- isoMDS(bcdist, k = 2)


plot(bcmds$points, type = "n", xlab = "", ylab = "")

text(bcmds$points, dimnames(Data)[[1]])

然后我明白了 graph。如何为图表中的每个点添加颜色?谢谢

这是我的 data

为每个 point/group 指定颜色或使用 pre-made 颜色托盘(必须至少与您的组数一样长):

cols <- c("red", "blue", "green"....etc)

然后在绘图函数中包含 col 参数,根据您的行名称选择标签颜色:

text(bcmds$points, dimnames(Data)[[1]], col = cols)