[R] Titles on lattice colorkey

r-help.20.trevva at spamgourmet.com r-help.20.trevva at spamgourmet.com
Fri Apr 3 11:10:01 CEST 2009


Dear R-ers,

I'm not sure if this is a missing feature, a support request, or stupidity on my part, but nevertheless, its a question. Is it possible to add titles to colorkey legends? As far as I can tell, there is a command to do it for normal "key" legends, but not for "colorkeys". 

eg it works for a normal key, created through auto.key

xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
       type = "a",
       auto.key = list(space = "right", points = FALSE, lines = TRUE,title="Key title"))

but there is no comparable command for a colorkey

x <- seq(pi/4, 5 * pi, length = 100)
y <- seq(pi/4, 5 * pi, length = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
          ylab="", main="Weird Function", sub="with log scales",
          region = TRUE,
          colorkey = list(space="right",title="Doesn't work"))


Cheers,

Mark




More information about the R-help mailing list