Any way to create histogram with matplotlib.pyplot without plotting the histogram?

前端 未结 4 2144

I am using matplotlib.pyplot to create histograms. I\'m not actually interested in the plots of these histograms, but interested in the frequencies and bins (I know I can write

4条回答
  •  面向向阳花
    2021-02-20 06:20

    You can use np.histogram2d (for 2D histogram) or np.histogram (for 1D histogram):

    hst = np.histogram(A, bins)
    hst2d = np.histogram2d(X,Y,bins)
    

    Output form will be the same as plt.hist and plt.hist2d, the only difference is there is no plot.

提交回复
热议问题