plot - Overlaid histograms in R (ggplot2 preferred) -


I am trying to create a layered histogram such as ggplot2:  style conspiracy that I would like to create

Here are some data and codes that I thought would work:

  My.data & lt; - data.frame (treatment = delegate (c (0, 1), 100), proposition = reinif (2 * 100) my.data & lt; - Conversions (my.data, treat = ifelse (=) 1, "treatment", "control")) my.data & lt; - Convergence (my.data, treat = as.factor (treat)) my.fig & lt; - ggplot () + geom_histogram (data = my   

but my code generates it: Enter image details here

Thanks! I like ggplot2 (while I'm learning, I felt that I learn mangosomic, extensible conspiracy languages I'm open to anything / everything.

I believe that you This is what:

overlined histogram < / P>

Note that I have changed my cure pointer variable to 0/1 instead of TRUE / FALSE , because it's about dividing ggplot There should be a factor for scale_lpha is a bit of a hack because it is for continuous variables, but as far as I can tell there is not a separate analogue.

  Library ('ggplot2') My.data and lt; - data.frame (treatment = representative (C (false, true), 100), proposition = runoff (2 * 100)) ggplot (my.data) + Geom_histogram (binwidth = 0.05, AES X = prop_score, alpha =     / Html>

Comments