John G. Bullock
2007-Dec-19 20:55 UTC
[R] lattice: axes drawn when relation='free' or relation='sliced' but not when relation='same'
I'm using lattice to draw a multi-panel figure: 5 rows, 4 columns. The y-axis for each panel is determined by yaxs <- list(draw=T , labels=c(0, '.5', '1', '1.5') , at=c(0, .5, 1, 1.5) , tck=c(.4, 0) , cex=.7 , alternating=2 , relation='same' , rot=90) fig1 <- xyplot( [...], scales=list(x=xaxs, y=yaxs)) I want this to draw ticks and labels on the left-hand side of each panel. Instead, I get ticks on the left-hand side of only the panels in the leftmost column, and labels only on the right-hand side of the rightmost column. What can account for that? What seems especially peculiar is that when I change relation to 'sliced' or 'free', the axes are drawn as I want them to be drawn. The data that I'm plotting are numeric and range from -.3 to 1.9. I'm using R 2.6.1 and lattice 0.17-2 on Windows XP. Thank you, --John
Deepayan Sarkar
2007-Dec-19 21:12 UTC
[R] lattice: axes drawn when relation='free' or relation='sliced' but not when relation='same'
On 12/19/07, John G. Bullock <john.bullock at aya.yale.edu> wrote:> > I'm using lattice to draw a multi-panel figure: 5 rows, 4 columns. The y-axis for > each panel is determined by > > yaxs <- list(draw=T > , labels=c(0, '.5', '1', '1.5') > , at=c(0, .5, 1, 1.5) > , tck=c(.4, 0) > , cex=.7 > , alternating=2 > , relation='same' > , rot=90) > > fig1 <- xyplot( [...], scales=list(x=xaxs, y=yaxs)) > > I want this to draw ticks and labels on the left-hand side of each panel. Instead, > I get ticks on the left-hand side of only the > panels in the leftmost column, and labels only on the right-hand side of the > rightmost column. What can account for that?Account for what? What you have described is a fundamental aspect of the design of Trellis graphics (which clearly happens to be different from how you would have designed it, but so what?).> What seems especially peculiar is that when I change relation to 'sliced' or 'free', > the axes are drawn as I want them to be drawn.Well, doesn't seem very peculiar to me.> The data that I'm plotting are numeric and range from -.3 to 1.9. I'm using R 2.6.1 > and lattice 0.17-2 on Windows XP.If you want the same limits in every panel even when relation="free", put in an explicit ylim=c(-0.2, 2) or something similar. -Deepayan