如何在这个条形图上获得价值?

时间:2018-03-19 04:20:10

标签: python-2.7 pandas matplotlib

我已经完成了在条形图上获取值所需的所有步骤。但我在这里面临一些问题。请帮帮我。分享代码和Screeenshot。

代码:

ax = sos_df ['状态']。value_counts()。plot(kind =' bar',figsize =(10,7),color =" coral&# 34;,fontsize = 13);

我得到如下输出:

The exact values required for the bar plot I have mentioned are not getting

请告诉我一些可以帮助我在情节上获得确切值的东西。在这里分享一个参考图片。:

The numbers which are in yellow color is the output I am looking for (Reference Image from google.com)

1 个答案:

答案 0 :(得分:0)

ax = sos_df['Status'].value_counts().plot(kind='bar', figsize=(10,7),color="coral", fontsize=13)
for a, b in zip(range(len(set(sos_df['Status']))), list(sos_df['Status'].value_counts())):
    plt.text(a, b, str(b), ha='center')
plt.show()

我想这就是你想要的......但我只能想象没有任何样本数据。