title: Normalizing two histograms in the same plot
body: <p>I would appreciate any insight with the following.</p>
  
  <p>I want to plot two datasets on one common histogram such that both histograms do not have their tops cut-off and have probability distributions ranging from 0 to 1. </p>
  
  <p>Let me explain what I mean. So far, I can plot the two datasets on one histogram nicely and force the integral of both distributions to be 1 by writing <code>normed = 1</code> in <code>ax.hist()</code>, as seen in the following figure:
  <a href="https://i.stack.imgur.com/15dQL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/15dQL.jpg" alt="enter image description here"></a> </p>
  
  <p>and which is produced from code like this:</p>
  
  <pre><code>        x1, w1, patches1 = ax.hist(thing1, bins=300, edgecolor='b', color='b', histtype='stepfilled', alpha=0.2, normed = 1)
  
          x2, w2, patches2 = ax.hist(thing2, bins=300, edgecolor='g', color='g', histtype='stepfilled', alpha=0.2, normed = 1)             
  </code></pre>
  
  <p>In the general case, one probability distribution is much higher than the other and it makes it hard to read the plot clearly. </p>
  
  <p>So, I've tried to normalise both such that they would both range from 0 to 1 on the y axis and still preserve their shape. For example, I've tried the following code: </p>
  
  <pre><code>for item in patches1:
      item.set_height(item.get_height()/sum(x1))
  </code></pre>
  
  <p>which is taken from the discussion here <a href="https://stackoverflow.com/questions/22241240/how-to-normalize-a-histogram-in-python">How to normalize a histogram in python?</a>, but python throws me an error message saying there is no such quality as <code>get_height</code>.</p>
  
  <p>My question is simply: How can I have it that so that the y axis ranges from 0 to 1 and preserve the shape of both distributions?</p>