title: Overplot the mean line in Python
body: <p>I'd like to get two lines (red and green) with the average of my data points in green and average of my data points in red. I'm using the following code, but it's not working. It's only showing the red and green data points, without the red average line</p>
  <pre><code> sns.set(rc={&quot;figure.figsize&quot;: (16, 8)})
  ax = events_all_metrics[[&quot;event_name&quot;,&quot;kambi_payback&quot;]].plot(x=&quot;event_name&quot;, style='.',use_index=False, color ='green')
  events_all_metrics[[&quot;event_name&quot;,&quot;pinny_payback&quot;]].plot(x=&quot;event_name&quot;,style='.', color='red', ax=ax)
  plt.tick_params(
      axis='x',          # changes apply to the x-axis
      which='both',      # both major and minor ticks are affected
      bottom='off',      # ticks along the bottom edge are off
      top='off',         # ticks along the top edge are off
      labelbottom='off')
  plt.legend(loc=4, prop={'size': 15})
  
  pinny_mean = events_all_metrics[&quot;pinny_payback&quot;].mean()
  ax.plot(pinny_mean, label='Pinny Mean', linestyle='--', color='red')
  plt.show()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/SjJZZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SjJZZ.png" alt="kambi_pinny" /></a></p>