[R] adding labels to a multiple plot in lattice

Deepayan Sarkar deepayan.sarkar at gmail.com
Sat Sep 10 22:54:50 CEST 2005

On 9/9/05, Jorge Ahumada <jahumada at usgs.gov> wrote:
> Hello,
> I am trying to a create a plot in lattice that has four panels, but  
> all of them have the same xlab and ylab, so instead of labeling each  
> plot  separately I want to create one single label for the y series  
> and one for the x series, somehow along the left and bottom margins  
> of the plot. Can anybody help? This is the pseudocode:
> print(xyplot(x1~y1),split=c(1,1,2,2),more=T)
> print(xyplot(x2~y2),split=c(2,1,2,2),more=T)
> print(xyplot(x3~y3),split=c(1,2,2,2),more=T)
> print(xyplot(x4~y4),split=c(2,2,2,2))

The obvious thing to do would be

a <- factor(rep(1:4, c(length(x1), length(x2), length(x3), length(x4))))
xyplot(c(x1, x2, x3, x4) ~ c(y1, y2, y3, y4) | a,
       scales = "free", xlab = "whatever")


More information about the R-help mailing list