[R] Plots of different aspect ratios on one page, base aligned(trellis.print)

Saptarshi Guha saptarshi.guha at gmail.com
Tue Mar 10 18:23:19 CET 2009


Hello,
I have an example of a 2 paneled plot, with two different aspect
ratios displayed on one page.
An example would help

n=20
x1 <- cumsum(runif(n))
x2 <- cumsum(runif(n))
d <- data.frame(val=c(x1,x2),id=c(1:n,1:n), nt=c(rep("A",n),rep("B",n)))
u1 <- xyplot(val~id | nt, data=d,aspect=1,layout=c(1,2))
u2 <- xyplot(val~id|nt, data=d,aspect=0.5,layout=c(1,2))
postscript("~/k.ps",colormodel="rgb",paper="letter",horiz=T)
print(u1,position=c(0,0,1/3,1),more=T,newpage=T)
print(u2,position=c(1/3,0,1,1),more=F,newpage=F)
dev.off()


The two figures are not base aligned. I would like them share the same
the baseline and same height, if necessary the paper width and height
can be adjusted
( i tried setting the paper width and height to no avail).

Is the way to base align the two figures? Do I have to get down the grid level?

Regards
Saptarshi Guha




More information about the R-help mailing list