I am trying to create a layered histogram like this with ggplot2: 
Here is some data and code that I thought would work:
my.data <- data.frame(treat = rep(c(0, 1), 100), prop_score = runif(2 * 100)) my.data <- transform(my.data, treat = ifelse(treat == 1, "treatment", "control")) my.data <- transform(my.data, treat = as.factor(treat)) my.fig <- ggplot() + geom_histogram(data = my.data, binwidth = 0.05, alpha = 0.01, aes(x = prop_score, linetype = treat, position = identity))
But my code produces this: 
Thanks! I would prefer ggplot2 (while I study, I decided that I was just learning a common, extensible building language), but I am open to anything / everything.
source share