Skip to content
Back to formatted view

Raw Message

Message-ID: <4CFB2FEE.5040001@ucalgary.ca>
Date: 2010-12-05T06:23:42Z
From: Peter Ehlers
Subject: scale caption on levelplot
In-Reply-To: <1291526954.2920.29.camel@rockhopper>

On 2010-12-04 21:29, Andrew Collier wrote:
> hi peter and david,
>
> thanks for the excellent suggestions. here is something like what i am
> finally using (those fancy fonts were really tempting, but i chose
> something a little more mundane!):
>
> library(lattice)
>
> x<- sort(rnorm(100,50,10))
> y<- sort(runif(100,0,20))
> d<- expand.grid(x=x, y=y)
> d$z<- x + y
> plot.new()
> p = levelplot(z ~ x*y, d,
>                 par.settings=list(
>                   layout.widths=list(right.padding=4)),
>                 colorkey = TRUE)
> print(p)
>
> mtext("CAPTION", 4, 1)

Even if that worked (it doesn't for me), you're still mixing
base (or tradtional) graphics with lattice graphics. Not a
good idea. I would replace the plot.new call with

  trellis.device()

and then, after the levelplot, replace the mtext with
grid.text(...) as I suggested originally. You'll have
to fiddle a bit with the x location but that should
be easy to get the way you want.

One more thing, since you imply that this is for
publication, it's a good idea to create the plot close
to the size that will ultimately be printed; resizing
is always better avoided.

Peter Ehlers

>
> your help really appreciated!
>
> best regards,
> andrew.
>