[R] Adding a legend to a symbol plot

Berton Gunter gunter.berton at gene.com
Thu Jun 2 22:09:41 CEST 2005


The symbol sizes, themselves, already encode the mean temperatures, so I'm
not exactly sure what you want to put in a legend. Perhaps the circles and
values for a few selected quantiles of the distribution to anchor the eye?
If so, legend() with pch and pt.cex does not appear capable of doing what
you want. However, it is simple to do by hand using symbols() and text()to
place the circles and values in the plot. If you want them outside the plot
region, set xpd  to TRUE (in both symbols() and text()). 

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> Jennifer.Morin at colorado.edu
> Sent: Thursday, June 02, 2005 11:57 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Adding a legend to a symbol plot
> 
> I have created a symbol plot with circles that represent the 
> mean temperature
> at lat/lon locations over the United States. The radius of the circle
> corresponds to the mean temperature. I would like to add a legend that
> identifies a range of temperatures (e.g. 0-10, 10-20, etc) 
> with circles of the
> appropriate radii next to them. I've read the manual on how 
> to add a legend,
> and I'm fine with adding one to the plot. However, I cannot 
> get circles of
> different sizes to come up next to the ranges in my legend. 
> All that is coming
> up are circles of all the same radius. In looking at the R 
> manual, it appears
> that in order to get the right radius for the circles, I have 
> to use the "pch"
> parameter in the "legend" command, but I'm unclear on how I 
> should define this
> parameter. Can anyone help?
> 
> thanks,
> Jennifer Morin
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list