[R] troubles with displaying legend on the plot

Spencer Graves spencer.graves at pdf.com
Wed Apr 16 15:44:38 CEST 2003


Another trick (which I think I got from Modern Applied Statistics with 
S) is to compute xlim manually and add 20% or 50% on the right or left 
to create the blank space you want for the legend.

hth
spencer graves

Dirk Eddelbuettel wrote:
> On Wed, Apr 16, 2003 at 12:26:11PM +0400, Wladimir Eremeev wrote:
> 
>>Is is possible to place the legend outside a plot in any other way
>>except using lattice package?
> 
> 
> Sort of -- I once did that using layout(). In essence you arrange two (or
> more) plots on a page. One of those plots remains 'empty' and only contains
> a legend, which gives the desired of having a plot with a separate legend.
> 
> 
>>BTW, maybe it would be useful to place this question in FAQ?
>>I've searched the mail archive. The question about placing the legend
>>outside a plot already have arose...
> 
> 
> This was discussed before. Simply trying one google query as in
>      http://www.google.com/search?q=legend+outside+r-help
> or     
>      http://www.google.com/search?q=legend+outside+site:r-project.org
> shows several results, including one with the simpler answer
>      par(xpd=T)
> 
> Hope this helps, Dirk
>



More information about the R-help mailing list