On Fri, Jan 2, 2009 at 11:00 PM, Jason Rupert <jasonkrup...@yahoo.com> wrote:
> I've seen this asked, but never fully answered.
>
> Is it possible to plot stacked histograms in R?
>
> I have four data sets that I would like to show combined vertically in 
> histogram format.
>
> Is this possible?

Yes, but it's generally not a terribly good way to display your data,
as it is hard to read the values of all except the series on the
bottom.

install.packages("ggplot2")
library(ggplot2)
qplot(carat, data = diamonds, binwidth = 0.1)
qplot(carat, data = diamonds, binwidth = 0.1, fill = cut)
qplot(carat, data = diamonds, binwidth = 0.1, fill = color)
qplot(carat, data = diamonds, binwidth = 0.1, fill = clarity)

More examples at http://had.co.nz/ggplot2/geom_histogram.html

Hadley


-- 
http://had.co.nz/

______________________________________________
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