【发布时间】:2021-03-27 08:04:46
【问题描述】:
我正在尝试将标签添加到作为图像附加的下方条形图中,并且我正在使用以下代码 有人可以帮忙吗?
#Count of Labels
Count = data.groupby(['kmeans']).size().reset_index(name='counts')
Count
Count.plot(x="kmeans", y=["counts"], kind="bar")
plt.title("Clustering Output grouped by Labels")
plt.xlabel("Labels_Predicted")
plt.ylabel("Total data points")
plt.savefig('label_count_img.png', dpi=1200)
【问题讨论】:
-
这能回答你的问题吗?:stackoverflow.com/questions/28931224/…
-
Matplotlib 文档包括an example on how to do this。
标签: python matplotlib label bar-chart