On Thu, Dec 16, 2010 at 11:12 PM, Rajarshi Guha <rajarshi.g...@gmail.com> wrote:
> Hi, I have a series of lattice plots which I am arranging in a 2x2
> grid via print:
>
> print(p.preds, split=c(1,1, 2,2), more=TRUE)
> print(p.comp, split=c(2,1,2,2), more=TRUE)
> print(p.bw, split=c(1,2,2,2), more=FALSE)
>
> What I'd like to have is a letter (A, B, ...) in the top corner of
> each plot. While panel.text lets me add text anywhere within a plot, I
> can't seem to workout how I could put some text in the top left
> corner, say, of the whole plotting region.
>


Try this using the built in data frame BOD:

library(lattice)
library(gridExtra)
pnl <- function(..., mark) {
        panel.xyplot(...)
        grid.text(mark, unit(.1, "npc"), unit(.9, "npc"))
}
fo <- demand ~ Time
grid.arrange(nrow = 2,
        xyplot(fo, BOD, mark = "A", panel = pnl),
        xyplot(fo, BOD, mark = "B", panel = pnl),
        xyplot(fo, BOD, mark = "C", panel = pnl)
)


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
R-help@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.

Reply via email to