[R] Fixing the physical size of Trellis graphs panels

Sébastien pomchip at free.fr
Thu Apr 10 23:33:35 CEST 2008


Dear R-users,

Please consider the following script:

#####

library(lattice)
ID <- rep(1:8,each=2)
x <- rep (c(1,2),8)
y <- c(rep(c(0.5,2),4),rep(c(50,1000),4))
df<-data.frame(ID,x,y)
g <- rep(1:2,each=8)
df.split<-split(df,g)

df.split

pdf(file="C:/Test.pdf")

for (i in 1:2) {
mydf<-as.data.frame(df.split[i])
myplot<-xyplot(mydf[,3]~mydf[,2]|mydf[,1],
       data=mydf,
       layout=c(2,2))
print(myplot)
}
dev.off()

You will find that the physical size of the panels are different on page 
1 and 2 because the axis labels have different length. Is it possible to 
fix the dimension of the panels regardless of the length of the axis labels?

Thank you for your input.

Sebastien



More information about the R-help mailing list