title: How to plot normalized histogram with pdf properly using matplotlib?
body: <p>I try to plot normalized histogram using example from <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html" rel="noreferrer">numpy.random.normal documentation</a>. For this purpose I generate normally distributed random sample.</p>
  
  <pre><code>mu_true = 0
  sigma_true = 0.1 
  s = np.random.normal(mu_true, sigma_true, 2000)
  </code></pre>
  
  <p>Then I fitt normal distribution to the data and calculate pdf.</p>
  
  <pre><code>mu, sigma = stats.norm.fit(s)
  points = np.linspace(stats.norm.ppf(0.01,loc=mu,scale=sigma),
                   stats.norm.ppf(0.9999,loc=mu,scale=sigma),100)
  pdf = stats.norm.pdf(points,loc=mu,scale=sigma)
  </code></pre>
  
  <p>Display fitted pdf and data histogram. </p>
  
  <pre><code>plt.hist(s, 30, density=True);
  plt.plot(points, pdf, color='r')
  plt.show() 
  </code></pre>
  
  <p>I use <code>density=True</code>, but it is obviously, that pdf and histogram are not normalized. </p>
  
  <p><a href="https://i.stack.imgur.com/2jZTu.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/2jZTu.jpg" alt="enter image description here"></a></p>
  
  <p>What can one suggests to plot truly normalized histogram and pdf?</p>
  
  <p>Seaborn distplot also doesn't solve the problem.  </p>
  
  <pre><code>import seaborn as sns
  ax = sns.distplot(s)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/179p6.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/179p6.jpg" alt="enter image description here"></a></p>