[R] create 3x2 panel boxplots
John Kane
jrkrideau at inbox.com
Tue Oct 30 18:13:53 CET 2012
I'm not sure it is "the most elegant" way but you can do this with ggplot2
You may have to install it, (install.packages("ggplot2")
A very basis example:
library(ggplot2)
mydata <- data.frame(aa = rep(letters[1:6], each = 11), bb = rep( c("x", "y"), 11),
cc <- rnorm(66))
p <- ggplot(mydata , aes( bb, cc ))+ geom_boxplot() +
facet_wrap( ~ aa )
p
Setting up the overall plot with titles, etc., can take a bit of time and head-pounding, but if you are doing a lot of graphs ggplot2 is a very useful tool to learn.
John Kane
Kingston ON Canada
> -----Original Message-----
> From: nikalk at gmail.com
> Sent: Tue, 30 Oct 2012 08:08:11 -0700 (PDT)
> To: r-help at r-project.org
> Subject: [R] create 3x2 panel boxplots
>
> Hi, I would like to create a trellis plot (3x2) of 6 individual box
> plots.
> It would look like this:
> (Created semi-manually)
> <http://r.789695.n4.nabble.com/file/n4647878/Figure8.jpg>
> What would be the most elegant way to do this?
> Thank you!
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/create-3x2-panel-boxplots-tp4647878.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________
FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
More information about the R-help
mailing list