条形图上的数据水平

问题描述 投票:0回答:1

我正在做一个情绪分析项目,我想在我的柱状图上添加数据级别,谁能帮帮我。先谢谢你:)

sns.set(font_scale=1.5)
data['Months'].value_counts().plot(kind='bar', figsize=(11, 6), rot=0)
plt.xlabel("Months", labelpad=16)
plt.ylabel("Count of Ratings", labelpad=12)
plt.title("Company - Count of Ratings by Months", y=1.02);

enter image description here

python pandas
1个回答
1
投票

我想明白了答案。:)

dx = data['Days'].value_counts()
dx.plot(kind='bar', figsize=(14, 7), rot=0, color='blue')

for i, v in enumerate(dx):
    plt.text(i -0.15, v +.2, " "+str(v), fontweight='bold')
© www.soinside.com 2019 - 2024. All rights reserved.