素包点色

Vegan package point colour

我正在使用以下代码进行 MDS 绘图,但我无法使用 pch 和 col 选项更改点符号和颜色。这是我的代码:

library(vegan) 
library(RColorBrewer)
xc <- cor(my.data, use  = "pairwise.complete.obs", method  = "spearman")
xc.dist <- dist(xc)
xcMDS <- monoMDS(xc.dist, k =2)
par(mar = c(5, 4, 1, 3))
plot(xcMDS, type = "n", ylim = c(-2,2), xlim = c(-2.5,2.5), las = 1, cex.axis = 0.75, xlab = "First dimension of non-metric  \n multidimensional scaling (NMDS)", ylab = "Second dimension of NMDS", xaxp=c(-2,2,4), yaxp=c(-2,2,4))
cols= "#66C2A5"
points(xcMDS, col = cols, pch = 16)

这是错误信息:

Error in xy.coords(x, y) : 
  'x' is a list, but does not have components 'x' and 'y'

monoMDS 没有 points() 方法。有人懒得写...

您可以使用

 points(scores(xcMDS), col = cols, pch = 16)

对于给您带来的不便,我们深表歉意。