On 1/26/06, Dieter Menne <[EMAIL PROTECTED]> wrote: > Dear Latticers, > > I want to position two trellis plots of different forms > side-by-side. The plot types are slightly different, > aspect=1 required, but panels should look the same in > both plots. Current workaround uses a guessed factor. > Any way to improve this? > > Dieter > > > library(lattice) > n1 = 20 > # I cannot rbind df1 and df2, because the x-dimensions are > # different and must be scaled individually
If that's the only reason, I would suggest rbind-ing them and then use scales = list(x = "free") If you want the first two columns to have the same x-limits, you can specify xlim = list(c(0,25), c(0,25), c(0, 2500)) etc. Otherwise, if you want the panels to have the same physical dimensions, look at the panel.width and panel.height arguments in ?print.trellis. I can't think of any other way of guaranteeing it. Deepayan > df1 = data.frame(y=rnorm(4*n1),x=rep(1:n1,4), > facA=rep(c("A","B"),each=2*n1),facB=rep(c("C","D"),each=n1)) > > # I add a dummy facB here, to make sure panels have same structure > df2 = data.frame(y=rnorm(2*n1),z=rep(100*(1:n1),2), > facA=rep(c("A","B"),each=n1),facB="C") > > # Note: aspect = 1 is required > p1 = xyplot(y~x|facA*facB,data=df1,main="Plot1",aspect=1, > between=list(x=2)) > p2 = xyplot(y~z|facA*facB,data=df2,main="Plot2",aspect=1,layout=c(1,2)) > > wi = 0.61 # this is trial-and-error > print(p1,position=c(0,0,wi,1),more=T) > print(p2,position=c(wi,0,1,1),more=F) ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html