title: Matplotlib's build-in interval plot
body: <p>I'm trying to plot multi intervals for multiple entries.</p>
  
  <p>I've tried using a loop to enumerate over the entries, plotting one interval at a time.</p>
  
  <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
  
  intervals = [(1, 2), (1.1, 2.5), (1.2, 4), (1.5, 10), (1.7, 12)]
  
  num_intervals = len(intervals)
  viridis = plt.cm.get_cmap('viridis', num_intervals)
  
  fig, ax = plt.subplots()
  for idx, (min_int, max_int) in enumerate(intervals):
    ax.hlines(y=idx, xmin=min_int, xmax=max_int, colors=viridis(idx / num_intervals), label=idx)
  ax.legend()
  plt.yticks([], [])
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/LqViO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LqViO.png" alt="plot"></a></p>
  
  <p>I wish to use matplotlib's build-in method for plotting multiple intervals all at once. Also, I wish to plot the min and max values for each interval in the image.</p>
  
  <p>I wish to add min &amp; max values annotations to the lines as such:
  <a href="https://i.stack.imgur.com/mJUqa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mJUqa.png" alt="min &amp; max values annotations"></a></p>