Rich Shepard
2012-Sep-06 18:03 UTC
[R] Lattice bwplot(): Changing Orientation of Plots in Multipanel Display
I've looked again at Deepayan Sakar's 'Lattice' book and not seeing the information I know must be in there. A clue stick would be much appreciated. A pair of box-and-whisker plots for two conditions of the same data set display each box plot horizontally (see attached pH figure). Relations of the two are not as easily seen as they would be if the two panels had the plots oriented vertically. Alternatively, the panels could be oriented horizontally so the two plots could be visually compared more easily. The command I used to produce the attached figure is: bwplot( ~ pH | era, data = chem.cast, main = 'pH', xlab = 'Standard Units') What do I add to this to change the plot orientations to vertical? And, where in the book are the details discussed? TIA, Rich -------------- next part -------------- A non-text attachment was scrubbed... Name: ph.pdf Type: application/pdf Size: 5207 bytes Desc: URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120906/6952fe77/attachment-0002.pdf>
Richard M. Heiberger
2012-Sep-06 18:40 UTC
[R] Lattice bwplot(): Changing Orientation of Plots in Multipanel Display
The primary recommendation is to use the "y ~ x" formula rather than the "~ y | x" formula. The place to look first is in the help files ?bwplot ?panel.bwplot Here is a example that matches your data structure Rich tmp <- data.frame(y=rnorm(20), x=rep(letters[1:2], each=10)) bwplot(y ~ x, data=tmp) bwplot(x ~ y, data=tmp) ## slightly longer, and illustrating the ## horizontal= and xlab= and ylab= arguments bwplot(y ~ x, data=tmp, horizontal=FALSE, xlab="group") bwplot(x ~ y, data=tmp, horizontal=TRUE, ylab="group") On 9/6/12, Rich Shepard <rshepard at appl-ecosys.com> wrote:> I've looked again at Deepayan Sakar's 'Lattice' book and not seeing the > information I know must be in there. A clue stick would be much > appreciated. > > A pair of box-and-whisker plots for two conditions of the same data set > display each box plot horizontally (see attached pH figure). Relations of > the two are not as easily seen as they would be if the two panels had the > plots oriented vertically. Alternatively, the panels could be oriented > horizontally so the two plots could be visually compared more easily. > > The command I used to produce the attached figure is: > > bwplot( ~ pH | era, data = chem.cast, main = 'pH', xlab = 'Standard Units') > > What do I add to this to change the plot orientations to vertical? And, > where in the book are the details discussed? > > TIA, > > Rich >
Rich Shepard
2012-Sep-06 18:59 UTC
[R] Lattice bwplot(): Changing Orientation of Plots in Multipanel Display
On Thu, 6 Sep 2012, Richard M. Heiberger wrote:> The primary recommendation is to use the "y ~ x" formula rather than the > "~ y | x" formula.Rich, I missed this.> The place to look first is in the help files > ?bwplot > ?panel.bwplotI tend to grab books first. :-)> Here is a example that matches your data structureThanks. Rich