how to draw a histogram in python matplotlib? -


my data name called ranges_freq

my data name called ranges_freq below

    buckets     userid    0   10           730    1   50           435    2   100          150    3   500          314    4   1000         97    5   1001         244   

i able draw bar chart using below code unable draw histogram same data.

>y = ranges_freq['userid']  xlabels = ranges_freq['buckets']  bar_width = 0.50  x = np.arange(len(y))  fig, ax = plt.subplots()  ax.bar(x, y, width=bar_width)  ax.set_xticks(x + (bar_width/2.0))  ax.set_xticklabels(xlabels)  ax.set_title('user frequency range')  ax.set_xlabel('buckets')  ax.set_ylabel('no.of.users')  plt.show() 

this how got image bar chart

so how can draw histogram samedata same parmeters have used barchart please me how draw histogram in same way?

so remove spaces in bar chart, thing need do, set

bar_width = 1.0 

result: enter image description here

but have understand is bar chart (just without spaces in between bars).


Comments

Popular posts from this blog

angularjs - Showing an empty as first option in select tag -

qt - Change color of QGraphicsView rubber band -

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -