An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20110920/00968912/attachment.pl>
returning site and species coordinates in NMDS using vegan
7 messages · L Quinn, Victor L. Landeiro, Cliff Beall +2 more
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20110920/07f94b21/attachment.pl>
On Tue, 2011-09-20 at 20:54 +0000, L Quinn wrote:
Hi, I am running a simple NMDS as outlined by Jari Oksanen in vegantutor, e.g. spp.dist<-vegdist(spp)spp.mds<-metaMDS(spp,trace=FALSE)spp.mds I am able to plot the results (species nicely overlaying sites) using plot(spp.mds,display="species",type="t",family="sans",font=2,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4))# and points(env.mds,display="sites") However, try as I might, I am not able to make this figure look pretty enough in R to satisfy journal editors/reviewers. I want to redraw the results in Excel, but I don't know how to extract species and site coordinates from spp.mds. I see that I can do this using isoMDS in MASS, but I'd prefer to use vegan. Perhaps I'm missing something obvious, but I haven't been able to find it anywhere so far. How does one go about extracting those coordinates? Thanks in advance. Lauren
Why don't you tell use what you want to do to produce a plot that will meet the reviewers/editors requirements? That way we can help you with R code to do the plot as I am 100% certain you won't be able to do a better job with Excel. Yes, I am that confident! I've published umpteen papers using vegan plots, that with a bit of crafting haven't had any problems getting past reviewers/editors of the ecological/environmental journals I have published in. G
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
The site coordinates are in spp.mds$points and the species coordinates are in spp.mds$species I have used those to make bubble plots, scaling the size of points by species abundance. I got the idea from PRIMER and extended it with R. I use the R graphics though, I think they are very flexible.
On Sep 20, 2011, at 4:54 PM, L Quinn wrote:
Hi, I am running a simple NMDS as outlined by Jari Oksanen in vegantutor, e.g. spp.dist<-vegdist(spp)spp.mds<-metaMDS(spp,trace=FALSE)spp.mds I am able to plot the results (species nicely overlaying sites) using plot(spp.mds,display="species",type="t",family="sans",font=2,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4))# and points(env.mds,display="sites") However, try as I might, I am not able to make this figure look pretty enough in R to satisfy journal editors/reviewers. I want to redraw the results in Excel, but I don't know how to extract species and site coordinates from spp.mds. I see that I can do this using isoMDS in MASS, but I'd prefer to use vegan. Perhaps I'm missing something obvious, but I haven't been able to find it anywhere so far. How does one go about extracting those coordinates? Thanks in advance. Lauren [[alternative HTML version deleted]]
_______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Hi Lauren, type ?plot or ?par and you will find several possibilities to change the view of your plot (most of them works in plot.cca to! It is a little bit tricky, but once you understood it, it will be much more easier and faster to build very nice plots in R as if you want to do the same in EXCEL or Power Point ( Power Point: Export the Graph as emf file to Power Point, with a dubble click on the graph you can change whatever you want to change, or use text fields) ? and if you save the code for the plot, changes in the future can be done much more faster, as if you have to do all these things in other programs. http://addictedtor.free.fr/graphiques/ here you can find several ideas (with the R code) how flexible R graphics are Sven
Von: r-sig-ecology-bounces at r-project.org [r-sig-ecology-bounces at r-project.org]" im Auftrag von "Gavin Simpson [gavin.simpson at ucl.ac.uk]
Gesendet: Dienstag, 20. September 2011 23:45 Bis: L Quinn Cc: r-sig-ecology at r-project.org Betreff: Re: [R-sig-eco] returning site and species coordinates in NMDS using vegan On Tue, 2011-09-20 at 20:54 +0000, L Quinn wrote: > Hi, > I am running a simple NMDS as outlined by Jari Oksanen in vegantutor, e.g. > spp.dist<-vegdist(spp)spp.mds<-metaMDS(spp,trace=FALSE)spp.mds > I am able to plot the results (species nicely overlaying sites) using > plot(spp.mds,display="species",type="t",family="sans",font=2,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4))# and points(env.mds,display="sites") > However, try as I might, I am not able to make this figure look pretty enough in R to satisfy journal editors/reviewers. I want to redraw the results in Excel, but I don't know how to extract species and site coordinates from spp.mds. I see that I can do this using isoMDS in MASS, but I'd prefer to use vegan. Perhaps I'm missing something obvious, but I haven't been able to find it anywhere so far. How does one go about extracting those coordinates? > Thanks in advance. > Lauren Why don't you tell use what you want to do to produce a plot that will meet the reviewers/editors requirements? That way we can help you with R code to do the plot as I am 100% certain you won't be able to do a better job with Excel. Yes, I am that confident! I've published umpteen papers using vegan plots, that with a bit of crafting haven't had any problems getting past reviewers/editors of the ecological/environmental journals I have published in. G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% _______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
On Tue, 2011-09-20 at 18:17 -0300, Victor L. Landeiro wrote:
Hi Lauren, site.scores<-scores(mds.result, display="sites") species.scores<-scores(mds.result, display="species")
I wanted to write that you can do this in a single call; but you can't. You should be able to, so I'll take a look at scores.metaMDS and improve it to work more like scores.cca for example. G
Note that your result from metaMDS function should be based on "raw data" not on "distance matrices". If your input to metaMDS function is a distance matrix you will not be able to recover species scores. victor On Tue, Sep 20, 2011 at 5:54 PM, L Quinn <lquinn at hotmail.com> wrote:
Hi,
I am running a simple NMDS as outlined by Jari Oksanen in vegantutor, e.g.
spp.dist<-vegdist(spp)spp.mds<-metaMDS(spp,trace=FALSE)spp.mds
I am able to plot the results (species nicely overlaying sites) using
plot(spp.mds,display="species",type="t",family="sans",font=2,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4))#
and points(env.mds,display="sites")
However, try as I might, I am not able to make this figure look pretty
enough in R to satisfy journal editors/reviewers. I want to redraw the
results in Excel, but I don't know how to extract species and site
coordinates from spp.mds. I see that I can do this using isoMDS in MASS, but
I'd prefer to use vegan. Perhaps I'm missing something obvious, but I
haven't been able to find it anywhere so far. How does one go about
extracting those coordinates?
Thanks in advance.
Lauren
[[alternative HTML version deleted]]
_______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
On Tue, 2011-09-20 at 20:54 +0000, L Quinn wrote:
Hi, I am running a simple NMDS as outlined by Jari Oksanen in vegantutor, e.g. spp.dist<-vegdist(spp)spp.mds<-metaMDS(spp,trace=FALSE)spp.mds I am able to plot the results (species nicely overlaying sites) using plot(spp.mds,display="species",type="t",family="sans",font=2,xlim=c(-0.4,0.4),ylim=c(-0.4,0.4))# and points(env.mds,display="sites") However, try as I might, I am not able to make this figure look pretty enough in R to satisfy journal editors/reviewers. I want to redraw the results in Excel, but I don't know how to extract species and site coordinates from spp.mds. I see that I can do this using isoMDS in MASS, but I'd prefer to use vegan. Perhaps I'm missing something obvious, but I haven't been able to find it anywhere so far. How does one go about extracting those coordinates? Thanks in advance. Lauren
In anticipation of you telling us what you want to do, the general advice is to plot aspects of the model fit by hand, in stages. # The recommended way of running NMDS (Minchin 1987) ## data(dune) # Global NMDS using monoMDS sol <- metaMDS(dune) ## extract scrs sites <- scores(sol, display = "sites") spps <- scores(sol, display = "species") ## compute axis ranges xlim <- range(sites[,1], spps[,1]) ylim <- range(sites[,2], spps[,2]) ## set up a blank plotting window plot(sol, type = "n", xlim = xlim, ylim = ylim) ## now do plotting with base R plotting functions, e.g. points(sites, col = "blue", pch = 16, cex = 1.2) text(spps, labels = rownames(spps), col = "red", cex = 0.6) If it is the overlap of labels etc that is annoying you, ordipointlabel() is your friend, or you can fiddle with things by hand using orditkplot(), push the result back to R and then plot it using ordiplot(). ## try this: ordipointlabel(sol) The success of any of these will depend on the number of sites and species etc. and their spacing in the ordination. orditkplot() provides the most flexibility, but you have to move all the labels by hand. G
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%