[R] Key for custom lattice panel function

Deepayan Sarkar deepayan at stat.wisc.edu
Wed Dec 10 02:09:00 CET 2003


On Tuesday 09 December 2003 16:37, Hadley Wickham wrote:
> Hi all,
>
> I've created a custom lattice panel function for levelplot - instead of
> representing z by colour, it plot circles with radius proportional to z
> (in the style of the map plots of Jacques Bertin).  I'm happy to email
> an example graph to anyone interested.
>
> The problem is now to create a key for the plot.  This is difficult
> because all of the other lattice plots convey information through point
> colour, shape, and texture, not point size.  For this reason (and having
> looked at the code) I don't think I can shoehorn $key or $colorkey to
> produce the type of key that I want.
>
> I'm using grid.circles() with native units that have been scaled in the
> same way as in panel.levelplot.
>
> Can anyone offer any suggestions as to how to create this key?

Exactly how do you want to your key to look like ? 

As things stand now, I don't think it would be possible to put arbitrary keys. 
However, this should be easy to fix. That is, we could allow the key to be an 
arbitrary grid object (as produced by draw.key and draw.colorkey), and use 
its "grobheight" or "grobwidth" to allocate the necessary space. I'll try to 
add this in the next major update.

For now, you could fake it by printing your "trellis" object in a grid 
viewport that's smaller than the whole screen, and draw your key separately 
afterwards in the remaining space. 

HTH,

Deepayan




More information about the R-help mailing list