VasoGene VasoGene - 3 months ago 11
R Question

Vegan package point colour

I am using the following code for MDS plotting and I have trouble with changing the point symbol and colour using pch and col options. Here it is my code:

xc <- cor(, 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)

This is the error message:

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


monoMDS does not have points() method. Somebody's been too lazy to write that...

You can use

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

Apologies for the inconvenience.