On Monday 02 December 2002 07:56 pm, Patrick Connolly
wrote:> In 'normal' plotting, by using text(.... outer = TRUE), I can set a
> title that can refer to multiple plots.
>
> I'm trying to achieve a similar effect with several trellis objects
> with which I wish to use a common key. I can only think of
> complicated ways of achieving such an end by using a separate grid
> graphic which didn't have any plot, but text only.
>
> Is there something more elegant?
I'm guessing that you are positioning your plots by calling print.trellis
explicitly with the position/split argument. Once these are complete, the
whole plotting region should be the default viewport, so you could simply use
grid.text to write your title. for example,
foo <- xyplot(...)
print(foo, position = c(0,0,.5,.8), more = TRUE)
print(foo, position = c(.5,0,1,.8), more = FALSE)
grid.text("Title", x = .5, y = .9)
If by key you mean a legend (as produced by 'key' in a lattice call),
you
could use something like
draw.key(key = list(rect = list(col = 1:3)),
draw = TRUE,
vp = viewport(x=.5, y=.9))
In either case, you would have to position the initial plots so that enough
space is left.
Hope that helps.
-Deepayan