仅在值和索引条形图中显示熊猫

时间:2016-12-12 13:18:41

标签: python pandas bar-chart

你好首先我是熊猫的新手。我想条形图我的价值观和指数,一切都很好但是 as you can see on the top right of this image它也向我展示了我基本上不想要的专栏。无论如何,我只能用索引和值显示条形图而不是列?谢谢。我非常感谢你的帮助。

df=pd.DataFrame([11,62,82,120,125,141,192,38],index=['10-20','21-30','31-40','41-50','51-60','61-70','71-80','81-90']) 

    ax = df.plot(kind='bar',stacked = False, colormap = 'Paired')
    for p in ax.patches:
            ax.annotate(np.round(p.get_height(),decimals=0), (p.get_x()+p.get_width()/2., p.get_height()), ha='center', va='center', xytext=(2, 10), textcoords='offset points')
    plt.ylabel('Number of co-occurrences ')
    plt.title('Occurences by Age Group')
plt.show()

0 个答案:

没有答案