I'm a TOTAL beginner, so sorry if this is easily solved. I am trying to put error bars on this histogram; I already have the error I want to use. It seems like everything I try just causes some sort of error that I don't understand. How would you approach this? I know this question has been asked on stack overflow plenty of times before, but every time I try to use a solution from those questions, I just get endless errors. Is there something fundamentally wrong with what I'm doing?
plt.figure()
#plotting histogram of data
result = plt.hist(zvel, bins=20)
#Plotting gaussian distribution to fit over it
mean = np.mean(zvel)
variance = np.var(zvel)
sigma = np.sqrt(variance)
x = np.linspace(min(zvel), max(zvel), 100)
dx = result[1][1] - result[1][0]
scale = len(zvel)*dx
plt.plot(x, mlab.normpdf(x, mean, sigma)*scale)