[R] color key with xyplot

Deepayan Sarkar deepayansarkar at yahoo.com
Thu Mar 28 20:11:02 CET 2002

Do you mean a colorkey as is usually drawn in levelplot (and not key) ? 
xyplot is not designed to draw color keys directly. You could use the key
argument to xyplot to emulate it somewhat 
(something like key = list(rect = list(col = 1:7), space = "right"))

Alternately, you could modify the object produced by xyplot to add a colorkey
component, which would be enough to fool print.trellis:

foo <- xyplot(<whatever>)
foo$colorkey <- list(col = 1:7,  at = 1:8, tick.number = 10)

--- Renaud Lancelot <lancelot at sentoo.sn> wrote:
> Dear all,
> I'd like to draw a color key beside a graph drawn with xyplot (lattice
> library). I am aware of the draw.colorkey function (grid library) but
> don't know how to handle it. Any hint would be appreciated.
> Renaud


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list