• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
27 views

Problem :

While drawing graphs using ggplot2 getting bellow error
statbin requires a continuous x variable the x variable is discrete. perhaps you want stat="count"?
by (6.9k points)  

1 Answer

0 votes

Solution :

I had the same issue in the past to resolve my issue i followed bellow instructions

Please use geom_bar() instead of geom_histogram, Also please refer sample code given bellow it provides separate graph for each month for birth date data:

ggplot(data = pf,aes(x=dob_day))+
geom_bar()+
scale_x_discrete(breaks = 1:31)+
facet_wrap(~dob_month,ncol = 3)
by (33.3k points)  
...