title: Fit a distribution to a histogram
body: <p>I want to know the distribution of my data points, so first I plotted the histogram of my data. My histogram looks like the following:
  <img src="https://i.stack.imgur.com/HQOYp.png" alt="my histogram"></p>
  
  <p>Second, in order to fit them to a distribution, here's the code I wrote:</p>
  
  <pre><code>size = 20000
  x = scipy.arange(size)
  # fit
  param = scipy.stats.gamma.fit(y)
  pdf_fitted = scipy.stats.gamma.pdf(x, *param[:-2], loc = param[-2], scale = param[-1]) * size
  plt.plot(pdf_fitted, color = 'r')
  
  # plot the histogram
  plt.hist(y)
  
  plt.xlim(0, 0.3)
  plt.show()
  </code></pre>
  
  <p>The result is:</p>
  
  <p><img src="https://i.stack.imgur.com/o5v1E.png" alt="enter image description here"></p>
  
  <p>What am I doing wrong?</p>