[R] key in margin area

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Jan 21 08:40:04 CET 2003


Jeremy Z Butler wrote:
> Hi
> Is there any way to position a key (legend) outside the plot area? i.e. 
> in the margin between plot area and page margin. I realise I could 
> achieve the same effect by creating a larger plot but not printing the 
> axes and then draw the smaller axes independantly leaving room for the 
> key. However, that wont work very well in my particular case.

You might want to extend the margins. See ?par for details, particularly 
look for arguments 'mar' and 'oma'.
After
  par(xpd = TRUE)    # Again, see ?par
you can plot a legend into the margins.

Uwe Ligges




More information about the R-help mailing list