Re: [R] Subplot.

2007-07-13 Thread Deepayan Sarkar
On 7/13/07, suman Duvvuru <[EMAIL PROTECTED]> wrote:
> Hello All,
>
> I wanted to do many plots (in my case, wanted to get 6 histograms) on the
> same figure. Is there a  method in R that analogous to 'subplot' in MATLAB?

Here are a few possibilities:


data(singer, package = "lattice")

## using traditional graphics

singer.split <- with(singer, split(height, voice.part))
par(mfrow = c(2, 4))
for (i in names(singer.split))
hist(singer.split[[i]], main = i, xlab = "height")

## using lattice

library(lattice)
histogram(~height | voice.part, singer)

## using ggplot2

library(ggplot2)
qplot(height, data = singer, geom = "histogram", facets = voice.part ~ .)

-Deepayan

__
R-help@stat.math.ethz.ch 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] Subplot.

2007-07-13 Thread suman Duvvuru
Hello All,

I wanted to do many plots (in my case, wanted to get 6 histograms) on the
same figure. Is there a  method in R that analogous to 'subplot' in MATLAB?
Any help will be very much appreciated.

thanks,
Suman

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.