[R-sig-eco] nMDS plot with points of different size
Gavin Simpson
gavin.simpson at ucl.ac.uk
Thu Mar 7 18:15:38 CET 2013
On Thu, 2013-03-07 at 15:37 +0000, Mark Fulton wrote:
> There's probably something "off the shelf", but
> I use a little function written in R:
>
> #A function for doing an xyz bubbleplot.
> bubbleplot <- function(x, y, z, bmax=4, bmin=.5) {
> plot(x,y, type="n")
> z <- z-min(z); z <- z/max(z)
> for (i in 1:length(x)) {
> points(x[i],y[i],cex=bmin+(bmax-bmin)*z[i])
> }
> }
`points()` is vectorised and can take numeric vectors for relevant
arguments. Hence you don't need the `for()` loop here. Just generate the
vector of cex values you want and pass the whole thing plus all
coordinates to `points()`:
cex <- bmin+(bmax-bmin)*z
points(x, y, cex = cex)
should be sufficient.
HTH
G
> This just makes an empty plot, and draws circles in it
> scaled to values in "z". You'll need to extract the axis
> scores from the NMDS output to use this. Tweak
> other graphics parameters as needed to get what you
> want.
>
> Dr. Mark Fulton
> Professor of Biology
> Bemidji State University
> Bemidji, MN 56601
> http://faculty.bemidjistate.edu/mfulton/
>
>
> -----Original Message-----
> From: r-sig-ecology-bounces at r-project.org [mailto:r-sig-ecology-bounces at r-project.org] On Behalf Of Stas Malavin
> Sent: Thursday, March 07, 2013 12:07 AM
> To: r-sig-ecology at r-project.org
> Subject: [R-sig-eco] nMDS plot with points of different size
>
> Dear list members,
>
> I want to plot an nMDS diagram with points' area proportional to the abundance of particular species. I could imagine just plotting with type = "n" and then using points() with different cex, but may be some special functions/packages exist for that which you can point me to?
>
> Thank you,
> Stas
>
>
> --------------------------------------------
> Junior Res Asst
> Hydrobiology Lab
> Institute of Limnology
> Russian Academy of Sciences
>
> Sevastyanova 9
> 196105 Russia, St Petersburg
> http://www.limno.org.ru
> Phone: +7 (812) 387-80-60
> Fax: +7 (812) 388-73-27
>
> [[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
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
More information about the R-sig-ecology
mailing list