title: Draw horizontal lines (matplotlib)
body: <p>I try to run the code:</p>
  
  <pre><code>fig, ax = plt.subplots()
  ax.plot(x, y, color="g") 
  ax.xaxis.set_major_locator(matplotlib.dates.YearLocator())
  ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%Y'))
  hlines=[40,50]
  ax.hlines(hlines, 1, len(x), color='g')
  plt.show()
  </code></pre>
  
  <p>I expect it to draw something like this:
  <a href="https://i.stack.imgur.com/gXbj1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gXbj1.png" alt="enter image description here"></a>
  Drawing chart is not a problem, it works, but drawing horizontal lines doesn't work.</p>
  
  <p>When I run my code it draws:</p>
  
  <p><a href="https://i.stack.imgur.com/Auh9e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Auh9e.png" alt="enter image description here"></a></p>
  
  <p>P.S. x created this way: dates to matplotlib dates</p>
  
  <pre><code>x.append(matplotlib.dates.date2num(datetime.strptime(date, '%Y%m%d')))
  </code></pre>