[R] Multiple levelplot with title
Deepayan Sarkar
deepayan.sarkar at gmail.com
Sat Oct 15 17:37:13 CEST 2011
On Sun, Oct 9, 2011 at 10:00 PM, Richard O. Legendi
<richard.legendi at gmail.com> wrote:
> Hi all,
>
> I'm new to R and to the mailing list, so please bear with me :-)
>
> I would like to create multiple levelplots on the same chart with a nice
> main title with something like this:
>
> print(levelplot(matrix(c(1,2,3,4), 2, 2)), split=c(1, 1, 2, 1))
> print(levelplot(matrix(c(1,2,3,4), 2, 2)), split=c(2, 1, 2, 1),
> newpage=FALSE)
>
> I found a trick:
>
> mtext("Test", outer = TRUE, cex = 1.5)
>
> here:
>
> https://stat.ethz.ch/pipermail/r-help/2008-July/168163.html
>
> but it doesn't works for me.
>
> Could anyone please show me some pointers what should I read in order to get
> an insight why this isn't working as I expect?
That part's easy: lattice is drawing using grid graphics, and mtext is
drawing using "traditional" graphics, and the two don't (easily) mix.
You will need to delve into grid a little bit for what you want. Do
you have a good reason to have separate levelplots? One of the main
points of lattice is to avoid such things.
-Deepayan
> What I managed to find a workaround by using panel.text(), but I don't
> really like it since it requires defined x/y coordinates and not scales if
> the picture is resized.
>
> panel.text(x=20, y=110, "Test")
>
> Thanks in advance!
> Richard
>
> ______________________________________________
> 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