Hi Petr, David and John,
  Thanks for the reply. I am sorry that I did not make it very clear.
"One on top of another" may not be the right expression.
Actually what I wanted is the second option of David's. There
are 10 columns in the plot and, in each column, there are three boxplots.
Different colors can be used to distinguish the three boxplots in the
same column.
    John, when I run the code, I got the message below:

Error in rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
In addition: Warning message:
In is.na(rows) : is.na() applied to non-(list or vector) of type 'NULL'


Thanks again, everyone.
      Hannah

2012/6/29 John Kane <jrkrid...@inbox.com>

> I think I may understand what you want.
>
> I 'd say the first thing to do is to combine the 3 matrices into a single
> data frame with a column for the values of A, B C
>
> Here is a mock-up with something like what I mean. I just used two columns
> of data for the mock-up.
>
> Then, you can reshape the data using melt() from the reshape2 package and
> then graph the data using ggplot from the ggplot2 package.
>
> Is this something like what you want?
> =============================================================
>
> library(ggplot2)
> library(reshape2)
>
> A  <-  data.frame( m = (rep("A", 10)) , b=rnorm(10), c = rnorm(10))
> B  <-  data.frame( m = (rep("B", 10)) , b=rnorm(10), c = rnorm(10))
> C  <-  data.frame( m = (rep("C", 10)) , b=rnorm(10), c = rnorm(10))
>
> mydata  <-  rbind( A, B, C )
> names(mydata)  <-  c( "group", "k1", "k2" )
> mdata  <-  melt(mydata)
>
> p  <-  ggplot( mdata , aes(variable, value , colour = variable )) +
> geom_boxplot() +
>           facet_grid( group ~ .)
> p
>
> ==============================================================
>
> John Kane
> Kingston ON Canada
>
>
> > -----Original Message-----
> > From: hannah....@gmail.com
> > Sent: Thu, 28 Jun 2012 16:29:54 -0400
> > To: r-help@r-project.org
> > Subject: [R] Help
> >
> > Dear all,
> >   I need some help on plotting multiple boxplots on one figure.
> >   I have three matrix A, B and C. Each of them is a 1000 by 10 matrix.
> > The 10 columns of all three matrix correspond to the
> > 10 values of the same parameter, say k=1, ..., 10.
> >   I want to make a plot where x axis represents different values of k.
> > For each k value, I want to plot three boxplots, one on top of another.
> > For example, for k=1, I want to draw three boxplot based on the first
> > column of A, B and C respectively. Similarly, I do the same for the rest
> > of
> > k values.
> >   Can some one give me some hint on this?
> >   Thank you so much.
> >         Hannah
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
>
> ____________________________________________________________
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and
> family!
> Visit http://www.inbox.com/photosharing to find out more!
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to