[R] Lattice bwplot(): Changing Orientation of Plots in Multipanel Display

Richard M. Heiberger rmh at temple.edu
Thu Sep 6 20:40:29 CEST 2012


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
>




More information about the R-help mailing list