[R] Titles on lattice colorkey

RBlonk robbert.blonk at gmail.com
Mon Nov 2 09:35:32 CET 2009


Dear Mark and all,

I am searching for a way to add a title to the colorkey in contourplot
(lattice) too and happy to see I am not the only one with this problem.

Did you already find out a solution, or is anyone else able to help us?
(For others, see below for an example by Mark)

regards,

Robbert

r-help.20.trevva wrote:
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://old.nabble.com/Titles-on-lattice-colorkey-tp22868692p26156623.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list