Skip to content
Prev 165895 / 398503 Next

R Stacked Histogram

On Fri, Jan 2, 2009 at 11:00 PM, Jason Rupert <jasonkrupert at yahoo.com> wrote:
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