1

I have some data frame:

Country Product_Category    count
1   Australia   Bikes   7064
5   Canada  Bikes   1548
7   France  Bikes   2770
10  Germany Bikes   3048
13  United Kingdom  Bikes   3524
16  United States   Bikes   8028

This is my code:

plot1 = df.groupby('Country')['Product_Category'].value_counts().rename('count').reset_index()
plot1 = plot1[plot1['Product_Category'] =='Bikes']
# plot
ax1 = sn.barplot(x="Country", y="count", data=plot1)
mean = plot1['count'].mean()
ax.axhline(mean,color='r')
plt.title('Sprzedaż rowerów w wybranych Państwach')

I would like put horizontal line on my plot which looks like a below: enter image description here

I would like put horizontal average line on my plot which might be looks like: enter image description here

I dont have any error and dont have any line i dont know why. Could you advise ?

M Z
  • 4,571
  • 2
  • 13
  • 27
Przemek Dabek
  • 519
  • 2
  • 14

1 Answers1

0

Try matplotlib.pyplot.axhline(df.Series.mean(), color='r', linestyle='--')

Sean.H
  • 640
  • 1
  • 6
  • 18