title: Fitting a Gaussian to a histogram with MatPlotLib and Numpy - wrong Y-scaling?
body: <p>I have written the below code to fit a Gaussian curve to a histogram. It seems to work, although the Y scaling is different. What am I doing wrong?</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  import matplotlib.mlab as mlab
  
  list = [0,1,1,2,2,2,3,3,4]
  
  plt.figure(1)
  plt.hist(list)
  plt.xlim((min(list), max(list)))
  
  mean = np.mean(list)
  variance = np.var(list)
  sigma = np.sqrt(variance)
  x = np.linspace(min(list), max(list),100)
  plt.plot(x,mlab.normpdf(x,mean,sigma))
  
  plt.show()
  </code></pre>
  
  <p>Thanks!</p>