Handling the axis range and intervals for a bar plot


#1

I am trying to plot a bar plot using the following code :
train.groupby(['hour']).Count.sum().plot(kind='bar')
and this plots the following graph :

but when i try to change the x-axis to be shown after an interval of 4 from the following code :
train.groupby(['hour']).Count.sum().plot(kind='bar') plt.xticks(np.arange(0,24,4))
it shows :

how to correctly manage the x-axis?
Thanks
Danish


#2

I’m sorry I did not understand your question correctly. Could you please ask again?

PS: you could refer the docs for a basic overview of plotting in pandas or refer this blog.

PPS: Has this something to do with autoscaling?


#3

In the second plot, with the code i have written there should be [0,4,8,12,16,20] on x-axis but here it is showing [0,1,2,3,4,5]