NMDS plotting issue
0
0
Entering edit mode
10 months ago
arshad1292 ▴ 100

Hello,

I have successfully generated the NMDS ordination (I think), and now want to plot it preferably using "ellipses". Here are all the script that I ran to reach to this step:

nmds <- read.csv(file = "mydata.csv", header = TRUE, row.names = 1) # read species data
nmds.env <- read.csv(file = "mydata_env.csv", header = T, row.names = 1) # read metadata or environment

And then

nmds1 <- metaMDS(nmds, distance = "bray", autotransform = FALSE)

This runs ordination and produces nice results (stress = 0.1)

Next, I run the following:

plot(nmds1) # this displays sites and species

All seems good until here. Next, when I try to plot it and use ellipses, then issue arises. Please see below:

ordiplot(nmds1, type = "n", main = "ellipses") # this runs fine
orditorp(nmds1, display = "sites", labels = F,  col = c("blue", "orange") [as.numeric(nmds.env$group)], cex = 1) # this produces error "NAs introduced by coercion" BTW I have only two groups that I want to colour blue and orange. 

As shown below, then I changed as.numeric to as.vector since I have a total of two groups and they are not numeric.

orditorp(nmds1, display = "sites", labels = F,  col = c("blue", "orange") [as.vector(nmds.env$group)], cex = 1)

The script runs but it produces no plot (no dots)

Next, when I run the following command:

ordiellipse(nmds1, groups = nmds.env$group, draw = "polygon", lty = 1, col = "grey90") # it draws empty ellipses nicely but contains no dots showing the data points. 

I want show the dots too. I have attached three figures.

  1. screenshot of "mydata.csv" file enter image description here
  2. screenshot of "mydata_env.csv" file enter image description here
  3. output of the plotting... that shows ellipses but no dots to represent data. enter image description here

Please help me in finding out where I went wrong with this. Thanks in advance!

NMDS metagenomic • 379 views
ADD COMMENT

Login before adding your answer.

Traffic: 2658 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6