Overlaid histograms using ggplot2 in R

r
kaggle
datavisualization
ggplot2

#1

Hi,

I want an overlaid histogram on my dataset from bike sharing demand problem on Kaggle.
data frame->

I tried to plot overlaid histograms like this ->

ggplot(train, aes(x=temp, fill=as.factor(day))) +

  •      geom_histogram(binwidth=.5, alpha=.5, position="identity")
    

and I get something like this->

Instead of this count on the y axis, I want the actual count variable from my dataset.
How can I do this?

Thanks


#2

see here aes= aesthetic

aes(x=temp, fill=as.factor(day))

this is where you are defining the x and y axis

then see