Hi:

To make a more legible ordering of the plots, it might be a good idea to
make m$L1 an
ordered factor rather than a character variable:

m$L1 <- ordered(m$L1, levels = paste('dataset', 1:15, sep = ''))
# Lattice
bwplot(value ~ x | L1, data = m, as.table = TRUE)
# ggplot2
 ggplot(m)+
  geom_boxplot(mapping=aes(x, value))+
  facet_wrap(~L1)

Nice example!

HTH,
Dennis

On Tue, Dec 29, 2009 at 3:48 AM, baptiste auguie <
baptiste.auguie@googlemail.com> wrote:

> Hi,
>
> Here is some artificial data followed by minimal ggplot2 and lattice
> examples,
>
> makeUpData <- function(){
>  data.frame(x=sample(letters[1:4], 100, repl=TRUE), y=rnorm(100))
>  }
>
> datasets <- replicate(15, makeUpData(), simplify=FALSE)
> names(datasets) <- paste("dataset", seq_along(datasets), sep="")
>
> str(datasets)
>
> require(reshape)
> ## combine the datasets in one long format data.frame
> m <- melt(datasets, meas=c("y"))
>
> str(m)
>
> require(ggplot2)
>
> ggplot(m)+
>  geom_boxplot(mapping=aes(x, value))+
>  facet_wrap(~L1)
>
> # or more concisely
> qplot(x, value, data=m, geom="boxplot", facets=~L1)
>
> require(lattice)
>
> bwplot(value~x | L1, data=m)
>
> HTH,
>
> baptiste
>
> 2009/12/29 Lorenzo Isella <lorenzo.isella@gmail.com>:
> > Dear All,
> > I am given 15 different data sets and I would like to generate a panel
> > showing all of them.
> > Each dataset will be presented either as a boxplot or as a histogram.
> > There are several possible ways to achieve this (as far as I know)
> >
> > (1) using plot and mfrow()
> > (2) using lattice
> > (3) using ggplot/ggplot2
> >
> > I am not very experienced (to be euphemistic) about (2) and (3).
> > My question then is: how would you try to organize these 15
> > histograms/boxplots  into a single figure?
> > Can anyone provide me with a simple example (with artificial data) for
> > (2) and (3) (or point me to some targeted online resource)?
> > Any suggestion is welcome.
> > Many thanks
> >
> > Lorenzo
> >
> > ______________________________________________
> > R-help@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.
> >
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]


