[R] discerning species by color in cca biplot

Gavin Simpson gavin.simpson at ucl.ac.uk
Mon Aug 16 23:11:18 CEST 2010


On Sat, 2010-08-14 at 21:17 +0800, elaine kuo wrote:
> Thanks
> 
> I wanna to add the species labels in a cca biplot
> based on species and environment conditions (maybe sites are of less
> relevance here).

0. It would help your learning if you actually read the help pages for
the functions I used, plus the vignettes that come with Vegan. One of
the key skills in using R when starting out is how to use the resources
at hand to help you solve problems yourself instead of having to rely on
the list. It must be frustrating waiting on someone to answer

> 1.
> Gavin's suggestion worked but the dots previously displayed
> using plot(birdrich.cca, scaling  =  -1) were gone. Pls advise how to retain
> the dots.

Those were the site or sample scores. They can be added to a plot using
the points method for cca objects (see ?points.cca)

points(birdrich.cca, display = "sites", scaling = -1)

> 
> 2. orditorp
> orditorp in vegan seems to fit my demand.
> However, the axis seems to be changed after running the code below.
> Please kindly explain why or recommend any references.

Can you provide a reproducible example to illustrate what you are
seeing? I don't have birdrich so can't run your code. The example
in ?orditorp does not change the axes and a cursory look at the code
behind orditorp suggests to me that it would be impossible for it to
modify the axes.

So unless you can provide something I can run to reproduce the behaviour
you're observing...?

HTH

G

> 
> Thanks again.
> 
> # Now with orditorp and abbreviated species names
> cnam <- make.cepnames(names(birdrich))
> plot(birdrich.cca, dis="sp", type="n")
> stems <- colSums(birdrich)
> orditorp(birdrich.cca, "sp", label = cnam, priority=stems, pch="+",
> pcol="grey")
> 
> 
> Elaine
> 
> 
> 
> 
> 
> original code
> 
> rm(list=ls())
> plot.new()
> 
> library(vegan)
> library(MASS)
> 
> 
> # input richness
> birdrich <-read.csv("c:/migration/CCA_Mig_richness_20100814.csv",header=T,
> row.names=1)
> 
> # input environment
> birdenvi <-read.csv("c:/migration/CCA_Mig_envi_20100815.csv",header=T,
> row.names=1)
> 
> birdrich.cca  <-  cca(birdrich  ~  .,  birdenvi)
> birdrich.cca
> plot(birdrich.cca, scaling  =  3, dis="sp", type="t")
> 
> 
> On Sat, Aug 14, 2010 at 8:30 PM, Gavin Simpson <gavin.simpson at ucl.ac.uk>wrote:
> 
> > If you only have seven species, why not draw the label for the species
> > (the names() component of your data) at the species score, rather than a
> > colour?
> >
> > plot(OBJ, display = c("sites","species"), scaling = 3, type = "n")
> > points(OBJ, display = "sites", scaling = 3, type = "p")
> > points(OBJ, display = "species", scaling = 3, type = "t")
> >
> > Not tested, am away at the moment but heading home. If you are still
> > having trouble (and I see now why you wanted matplot) then email back and
> > I'll given a longer example illustrating who to build up plots by hand.
> >
> > Gavin
> >
> >
> >
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list