x = np.linspace(2, 8, 1000) bins = plt.hist(meanVels, bins=7) centers = (bins[1][1:]+bins[1][:-1])/2 fit, covar = curve_fit(nonStatGaus, centers, bins[0], p0=[4.5, 6, 7]) plt.plot(x, nonStatGaus(x, *fit)) plt.show()