2016-08-16 27 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'。應該出現在純素將來的版本中。 –

相關問題