Trawling the online and pdf manuals for density plots further I found a
reference to position and tried it with histograms. It worked!

So here is an example that gives me overlapping histograms, alpha
transparency so they can both be seen in the area of overlap, and with
properly labelled and colored legend.

require(ggplot2)
x <- data.frame(value=rnorm(5000, mean=0), case="A")
y <- data.frame(value=rnorm(5000, mean=3), case="B")
xy <- rbind(x, y)
ggplot(xy, aes(x=value, fill=case, group=case)) + geom_histogram(alpha=0.5,
binwidth=0.1, position="identity")

hth
-- 
View this message in context: 
http://www.nabble.com/ggplot2-legend-problem-tp25036665p25037667.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.

Reply via email to