I try to plot both geom_histogram
and geom_density
in one figure. When I plot the two separate from each other I get for each the output I want (histogram and density plot) but when I try combining them, only the histogram is showed (regardless of which order of the histogram/density in the code).
My code looks like this:
ggplot(data=Stack_time, aes(x=values))+geom_density(alpha=0.2, fill="#FF6666")+
geom_histogram(binwidth = 50, colour="black", fill="#009454")
I do not receive any error message, but the geom_density
is never shown in combination with the geom_histogram
.