[R] ggplot2 legend problem - SOLVED
Chris Friedl
cfriedalek at gmail.com
Wed Aug 19 06:35:19 CEST 2009
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.
More information about the R-help
mailing list