title: Horizontal stacked bar plot and add labels to each section
body: <p>I am trying to replicate the following image in matplotlib and it seems <code>barh</code> is my only option. Though it appears that you can't stack <code>barh</code> graphs so I don't know what to do</p>
  <p><img src="https://i.stack.imgur.com/CN4DT.png" alt="enter image description here" /></p>
  <p>If you know of a better python library to draw this kind of thing, please let me know.</p>
  <p>This is all I could come up with as a start:</p>
  <pre><code>import matplotlib.pyplot as plt; plt.rcdefaults()
  import numpy as np
  import matplotlib.pyplot as plt
  
  people = ('A','B','C','D','E','F','G','H')
  y_pos = np.arange(len(people))
  bottomdata = 3 + 10 * np.random.rand(len(people))
  topdata = 3 + 10 * np.random.rand(len(people))
  fig = plt.figure(figsize=(10,8))
  ax = fig.add_subplot(111)
  ax.barh(y_pos, bottomdata,color='r',align='center')
  ax.barh(y_pos, topdata,color='g',align='center')
  ax.set_yticks(y_pos)
  ax.set_yticklabels(people)
  ax.set_xlabel('Distance')
  
  plt.show()
  </code></pre>
  <p>I would then have to add labels individually using <code>ax.text</code> which would be tedious. Ideally I would like to just specify the width of the part to be inserted then it updates the center of that section with a string of my choosing. The labels on the outside (e.g. 3800) I can add myself later, it is mainly the labeling over the bar section itself and creating this stacked method in a nice way I'm having problems with. Can you even specify a 'distance' i.e. span of color in any way?</p>
  <p><img src="https://i.stack.imgur.com/Eb3fS.png" alt="enter image description here" /></p>