[R] For multiple trellis plot, how to add a global title

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Nov 2 20:07:32 CET 2005


On 11/2/05, alexfang at stat.rutgers.edu <alexfang at stat.rutgers.edu> wrote:
>
>
> I use print.trellis() to draw multilple plots in a single frame, but than
> how
> could add a global title and subtitle to the final plot.  Thank you!
>
> eg code:
> print(position=(0,0,1,0,5), more=T, xyplot(...))
> print(position=(0,0.5,1,0,1), more=F, xyplot(...))
>
> ##### Will produce error if I put the following:
> # title(main="global main title")
> # title(sub="global sub title")
>
> What should I do?  thank you!

Use grid.text, e.g.

library(grid)
grid.text("global main title", x = 0.5, y = 0.99, just = c("centre", "top"))

-Deepayan




More information about the R-help mailing list