[R] lattice key subtitle

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Oct 28 18:54:16 CEST 2010


On Tue, Oct 26, 2010 at 2:49 AM, Alexandru Dumitrescu
<alexandru.dumitrescu at gmail.com> wrote:
> Hello everybody,
> Is there a way to add a subtitle to a lattice key?

None specifically for that purpose, but latticeExtra does have a
mergedTrellisLegendGrob() function that may help:

mylegend <-
mergedTrellisLegendGrob(list(fun = draw.key,
                             args = list(key = simpleKey(month.name[1:3],
                                                         title = "Months"))),
                        list(fun = grid::textGrob,
                             args = list("subtitle")),
                        vertical = TRUE)

xyplot(1 ~ 1,
       legend = list(top = list(fun = mylegend)))

mergedTrellisLegendGrob() was written as a helper function for
c.trellis(), but the plan is to eventually make it a bit more general
tool for combining legends.

-Deepayan

> It is important form me that the subtitle must be linked to the key
> because those graphs are produced on a daily temporal scale,
> and the numbers of  rectangles from the key may be different from day to
> day.
>
> Thank you,
> Alexandru Dumitrescu
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list