title: line graph with histogram underlaid and on side
body: <p>This is perhaps an unusual graph that I am trying to make, so I've attached an illustration. I'm not sure if it is possible in matplotlib, so I thought I'd ask here for how to do it. </p>
  
  <p><a href="http://i.imgur.com/96JRIN2l.jpg" rel="nofollow">http://i.imgur.com/96JRIN2l.jpg</a></p>
  
  <p>Basically I'd like to plot a histogram (with <code>hist()</code>) on its side and then on top, overlay a line graph (with <code>plot()</code>), keeping the axis the same for the y on both sides. </p>
  
  <p>Additionally I think it would only work if the histogram can have a lower opacity. Not sure if opacity can be set per plot instead of per figure.</p>
  
  <p>Code so far:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import numpy as np
  
  fig = plt.figure()
  ax1 = fig.add_subplot(111)
  line = [0.2, 0.3, 0.37, 0.4, 0.6, 0.7, 0.72, 0.75, 0.77, 0.78, 0.79, 0.795] 
  distribution = [0.2, 0.3, 0.3, 0.4, 0.7, 0.7, 0.7, 0.8]
  
  plt.hist(distribution, orientation='horizontal')
  plt.plot(range(len(line)), line, color='grey')
  
  plt.savefig("test.png")
  </code></pre>
  
  <p>The histogram doesn't show up.</p>
  
  <p>How can I do this?</p>