gpt4 book ai didi

python-3.x - Python matplotlib : add count number on top of the bar

转载 作者:行者123 更新时间:2023-12-04 03:13:56 26 4
gpt4 key购买 nike

<分区>

我有以下 matplotlib 代码:

ax = my_df.plot(x='arrival_month', y='my_count' ,kind='bar', figsize =  (20,10), fontsize = 16, color = 'b', alpha = 0.3)  
ax.set_xticklabels([t.get_text().split(" ")[0] for t in ax.get_xticklabels()])
ax.set_ylim([-50,300])
plt.show()

生成图形:

enter image description here

我想知道是否可以在栏的顶部添加计数,例如:

enter image description here

非常感谢!

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com