Very easy if you note that cex in plot can be a vector. example:
x <- runif(100) y<-runif(100) z<-runif(100) #shift and scale z for convenience 9the scaling is based on range 'cos we know this is in [0,1] #your mileage may vary but the principle is ) z.scaled <- 0.05 + (z-min(z))/diff(range(z)) plot(x, y, cex=2*z.scaled) #Symbol size increases linearly with z You can add a key by giving legend() a list of three or four cex values and corresponding distances in z, if yo like. But ggplot (as a previous poster indicated) is also a natural way to do this, and adds a nice key for you if you map a variable to an aesthetic. > -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Andrew Halford > Sent: 10 August 2011 11:03 > To: r-help@r-project.org > Subject: [R] plot 3d info in 2d > > Hi Listers, > > Is it possible to produce an ordination plot in 2d, where > bubbles represent the location of sites (this part is easy > enough) and the size of the bubbles is proportional to the > sites location in 3d space (I am stuck on this option). So > sites that are very near the 2d plane of the xy axes would be > larger while sites that are actually further away in 3 d > space would be proportionally smaller. > > any help/advice appreciated > > Andy > > -- > Andrew Halford Ph.D > Associate Research Scientist > Marine Laboratory > University of Guam > Ph: +1 671 734 2948 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ R-help@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.