title: matplotlib normed histograms
body: <p>I'm trying to draw part of a histogram using matplotlib.</p>
  
  <p>Instead of drawing the whole histogram which has a lot of outliers and large values I want to focus on just a small part. The original histogram looks like this:</p>
  
  <pre><code>hist(data, bins=arange(data.min(), data.max(), 1000), normed=1, cumulative=False)
  plt.ylabel("PDF")
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/4EJ7K.png" alt="enter image description here"></p>
  
  <p>And after focusing it looks like this:</p>
  
  <pre><code>hist(data, bins=arange(0, 121, 1), normed=1, cumulative=False)
  plt.ylabel("PDF")
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/KRz3J.png" alt="enter image description here"></p>
  
  <p>Notice that the last bin is stretched and worst of all the Y ticks are scaled so that the sum is exactly 1 (so points out of the current range are not taken into account at all)</p>
  
  <p>I know that I can achieve what I want by drawing the histogram over the whole possible range and then restricting the axis to the part I'm interested in, but it wastes a lot of time calculating bins that I won't use/see anyway.</p>
  
  <pre><code>hist(btsd-40, bins=arange(btsd.min(), btsd.max(), 1), normed=1, cumulative=False)
  axis([0,120,0,0.0025])
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/M9P7S.png" alt="enter image description here"></p>
  
  <p>Is there a fast and easy way to draw just the focused region but still get the Y scale correct?</p>