[R] Position of legend box

David Winsemius dwinsemius at comcast.net
Mon Oct 12 14:13:20 CEST 2009

On Oct 12, 2009, at 4:07 AM, ogbos okike wrote:

> Good morning to you. I have about 4 different lines in one plot. I  
> have used
> legend to indicate the colour of each plot. But the box contain the  
> legend
> covers part of the lines thereby blurring the legend. There are some  
> spaces
> in the plot that are empty and large enough to accommodate the  
> legend box.
> If there a command I could use to set the position of the legend  
> myself.
> I added the legend using:
>> legend(oo1$daymon[100],3600,c("2005","2006", 
>> 2004","2003"),col=c(4,2,3,1),lty=1)

This may be of help, courtesy of plotmeister Jim Lemon:


There are also facilities in  Harrell's Hmisc that do something similar:


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

More information about the R-help mailing list