Skip to content Skip to sidebar Skip to footer

How To Make A Histogram From A List Of Data

Well I think matplotlib got downloaded but with my new script I get this error: /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py:621: DeprecationWarning: U

Solution 1:

Automatic binning

how to make 200 evenly spaced out bins, and have your program store the data in the appropriate bins?

The accepted answer manually creates 200 bins with numpy.arange and numpy.linspace, but there are functions for automatic binning:


If you don't need to store the bins, then skip the binning step and just plot the histogram with bins as an integer:

  1. pyplot.hist

    plt.hist(data, bins=200)
    
  2. seaborn.histplot

    sns.histplot(data, bins=200)
    
  3. pandas.DataFrame[.plot].hist or pandas.Series[.plot].hist

    pd.Series(data).plot.hist(bins=200)
    

Post a Comment for "How To Make A Histogram From A List Of Data"