[R-sig-eco] controlling the species displayed on a biplot

Dave Roberts dvrbts at ecology.msu.montana.edu
Wed May 25 23:21:34 CEST 2011


Thanks Gavin.  That's actually very nice and I suspect just what Andy 
was looking for.

Dave

On 05/23/2011 04:33 AM, Gavin Simpson wrote:
> require(vegan)
> require(labdsv)
> data(dune)
> data(dune.env)
>
> ## Indicators of Management type
> set.seed(38)
> inds<- with(dune.env, indval(dune, Management))
>
> ## ordinate
> dune.pca<- rda(dune, scale = TRUE)
>
> ## exract scores you want to plot presume species and sites
> dune.site<- scores(dune.pca, display = "sites", scaling = 3)
> dune.spp<- scores(dune.pca, display = "species",
>                      scaling = 3)[inds$pval<= 0.05, ]
>
> ## plot
> plot(dune.pca, display = c("sites","species"), type = "n",
>       scaling = 3)
> points(dune.site)
> arrows(0, 0, dune.spp[,1], dune.spp[,2], col = "red", length = 0.05)
> lab.xloc<- dune.spp[,1] * 1.2
> lab.yloc<- dune.spp[,2] * 1.2
> text(lab.xloc, lab.yloc, rownames(dune.spp), col = "red", cex = 0.8)
>

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David W. Roberts                                     office 406-994-4548
Professor and Head                                      FAX 406-994-3190
Department of Ecology                         email droberts at montana.edu
Montana State University
Bozeman, MT 59717-3460



More information about the R-sig-ecology mailing list