2016-08-16 100 views
0

我正在使用以下代码进行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' 

回答

1

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

您可以使用

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

道歉的不便。

+0

非常感谢Jari Oksanen – VasoGene

+1

素食主义者的github存储库现已为'monoMDS'提供'points'和'text'。应该出现在纯素将来的版本中。 –