No; thanks for your try, but this is not what I want. Here each bar has one single color. I would like to render each bar with several colors according to the distribution of a factor.
I now learned that this is called "stacked histogram" (damned Excel). In the following entry https://stat.ethz.ch/pipermail/r-help/2007-April/129645.html Deepayan Sarkar has provided a solution though he doubts its value. Still, I find "stacked histograms" a vuable tool during exploratory data analysis. Hans Werner Is this what you want? dataset <- data.frame(x = c(rnorm(100), runif(100), rchisq(100, 1)), y = gl(3, 100, labels = LETTERS[1:3])) ggplot(dataset, aes(x = x, fill = y)) + geom_histogram() ggplot(dataset, aes(x = x, fill = y)) + geom_histogram(position = "dodge") HTH, Thierry ----- ---- Hans W. Borchers ABB Corporate Research Germany -- View this message in context: http://www.nabble.com/Histogram-with-colors-according-to-factor-tp18336930p18337935.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.