[R] scale caption on levelplot
    Peter Ehlers 
    ehlers at ucalgary.ca
       
    Sun Dec  5 07:23:42 CET 2010
    
    
  
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.
>
    
    
More information about the R-help
mailing list