I use matplotlib.pyplot to create bar charts. I'm not interested in the graphs of these histograms, but they are interested in frequencies and cells (I know that I can write my own code for this, but would prefer to use this package).
I know I can do the following:
import numpy as np import matplotlib.pyplot as plt x1 = np.random.normal(1.5,1.0) x2 = np.random.normal(0,1.0) freq, bins, patches = plt.hist([x1,x1],50,histtype='step')
to create a histogram. All I need is freq[0] , freq[1] and bins[0] . The problem occurs when I try to use,
freq, bins, patches = plt.hist([x1,x1],50,histtype='step')
in function. For instance,
def func(x, y, Nbins): freq, bins, patches = plt.hist([x,y],Nbins,histtype='step')
When I call func(x1,x2,Nbins) and print or print X and Y , I do not get the expected curve / value. I suspect this is due to plt.hist , as there is a partial histogram in my plot.