[R] [lattice] print only legend

David Winsemius dwinsemius at comcast.net
Wed Nov 21 22:25:30 CET 2012


On Nov 21, 2012, at 1:45 AM, AnjaM wrote:

> Is it possible to plot (and save) only the legend of a lattice plot? Of
> course I could make the axes and axis labels transparent and use an empty
> panel function, but additionally to being a very "dirty" solution, there
> would be still a lot of free space on the plot, while I would like to save
> only the legend as a separate plot without any white space around it. Is
> there a (nice) way to do this?
> 

If you read the help page:

? xyplot

... it should not be too hard to find the section that names the grid function that draws a key. Unsurprisingly, it is `draw.key`.

-- 
David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list