The table below shows the number of ice creams brought and the number of customers brought that number of ice creams.
ice_cream No_of_customers
1 225
2 170
3 55
4 20
5 20
6 10
The estimated probability of purchasing the number of ice cream is shown below. e.g. probability of purchasing 1 ice cream is 225/500 = 0.45. This table below shows that distribution of number of ice cream sold
ice_cream Probability
1 0.45
2 0.34
3 0.11
4 0.04
5 0.04
6 0.02
while showing this above distribution as a graph with the below code I was expecting my y- axis in histogram plot to have same values as in probability column
ggplot(data = ice_cream)+
geom_histogram(aes(x = ice_cream,y = ..density..))
I tried density plot but y axis is not the one in probability column for each ice cream column. I am missing something very basic here.
Can someone please suggest how to get that probability in the graph?
Sample data:
ice_cream <- data.frame(ice_cream = c(rep(1,225),rep(2,170),rep(3,55),rep(4,20),rep(5,20),rep(6,10)))