# How to plot PCoA, NMDS... directly from mothur?

**URL:** <https://forum.mothur.org/t/how-to-plot-pcoa-nmds-directly-from-mothur/3317>\
**Category:** Commands in mothur\
**Created:** [July 4, 2017, 3:47pm UTC](https://forum.mothur.org/t/how-to-plot-pcoa-nmds-directly-from-mothur/3317 "2017-07-04T15:47:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mafernandez](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@mafernandez](https://forum.mothur.org/u/mafernandez)\
**Post date:** [July 4, 2017, 3:47pm UTC](https://forum.mothur.org/t/how-to-plot-pcoa-nmds-directly-from-mothur/3317/1 "2017-07-04T15:47:03Z")

</div>

I am follwing MiSeq\_SOP and I have reached the PCoA (from OTUs and phylogenetic approaches) and NMDS generation steps.

I have obtained the files with the distances (.axes, and so on) and all the other files from these commands. However, I do not know how can I plot the results to get some beautiful figures for my future publications.

Is there any way to have these plots directly from MOTHUR?  
Is there any other way to do so in a straightforward manner?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![dwaite](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@dwaite](https://forum.mothur.org/u/dwaite)\
**Post date:** [July 4, 2017, 9:56pm UTC](https://forum.mothur.org/t/how-to-plot-pcoa-nmds-directly-from-mothur/3317/2 "2017-07-04T21:56:30Z")

</div>

Within mothur, no. But the .axes files are easy to load into Excel or R and plot. There’s a nice R tutorial on the wiki ([here](https://www.mothur.org/wiki/R_tutorial)) that has a worked example of plotting an NMDS near the bottom of the page.

---

<div class="post-metadata">

**Author:** ![mafernandez](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@mafernandez](https://forum.mothur.org/u/mafernandez)\
**Post date:** [July 6, 2017, 7:05am UTC](https://forum.mothur.org/t/how-to-plot-pcoa-nmds-directly-from-mothur/3317/3 "2017-07-06T07:05:59Z")

</div>

Thanks dwaite!

I have searched the R tutorial for mothur and I have found the functions you said.

However, they didn’t work as I needed, so I generate new R code for having a plot of the nmds/PCoA distances, just having the points and their names in black:

```nohighlight
nmds<-read.table(file="nmds.axes", header=T)
rownames(nmds)<- nmds[,1]
sample_names.nmds<-factor(rownames(nmds))
plot(nmds$axis2~nmds$axis1, xlab="Axis 1", ylab="Axis 2")
with(nmds, text(x = axis1, y = axis2, labels = sample_names.nmds))

```

Hope it will help someone!!
