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@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.
> 
> 

Maybe using library(grid) we can solve. Try

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"),
          legend=list(top=list(fun=grid::textGrob("Size\n(m)", x=1.09))))

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

______________________________________________
R-help@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.

Reply via email to