[R] Placing legends

Frank E Harrell Jr feh3k at spamcop.net
Sun Oct 5 13:04:36 CEST 2003


On Sat, 04 Oct 2003 18:38:40 -0700
Doug Bourne <bournephysio at shaw.ca> wrote:

> I'm trying to automate making a bunch of figures and I need a way to 
> automate legend position.  As I understand it the legend is placed based 
> on coordinates.  I don't know before hand what the coordinates are going 
> to be.  On one graph my y axis might go from -50 to -10.  On another it 
> might go from 0 to 180.
> 
> Is there any way to query where the origin is?  Or is there another way 
> to place the legend?
> 
> Thanks,
> Doug Bourne
> Graduate Student
> University of British Columbia
> 

If you want to go a bit farther, the labcurve function in the Hmisc package can put a legend on the most empty portion of the plot automatically, or it can label curves directly, where they are most separated.
---
Frank E Harrell Jr    Professor and Chair            School of Medicine
                      Department of Biostatistics    Vanderbilt University




More information about the R-help mailing list