This is my first post on Stack Overflow, my first reproducible example, and I'm new to R, so please be gentle! I am trying to display two histograms on one plot. Each histogram is a different variable (column) in my dataframe. I can't figure out how to both colour in the bars and have the legend displayed. If I use scale_fill_manual the colours are ignored, but if I use scale_colour_manual the colours are just the outlines of the bars. If I map the colours to each histogram separately (and don't use scale_xxx_manual at all) the colours work great but I then don't get the legend.
Here is my code:
TwoHistos <- ggplot (cars) +
labs(color="Variable name",x="XX",y="Count")+
geom_histogram(aes(x=speed, color= "Speed"), alpha = 0.2 ) +
geom_histogram(aes(x=dist, color= "Dist"), alpha = 0.2) +
scale_colour_manual(values = c("yellow","green"))
TwoHistos
Here is my result in an image (I pasted it but I don't know why it isn't showing up. I'm sorry!): Two histograms with outlines for colours

