Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
108 views
in Technique[技术] by (71.8m points)

python - Average line on plot

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 ?

question from:https://stackoverflow.com/questions/65640677/average-line-on-plot

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...