【发布时间】:2016-03-09 18:07:27
【问题描述】:
我使用 pyplot 绘制饼图。
import pylab
import pandas as pd
test = pd.Series(['male', 'male', 'male', 'male', 'female'], name="Sex")
test = test.astype("category")
groups = test.groupby([test]).agg(len)
groups.plot(kind='pie', shadow=True)
pylab.show()
结果:
但是,我无法移除左侧的标签(图中标记为红色)。我已经试过了
plt.axes().set_xlabel('')
和
plt.axes().set_ylabel('')
但这没有用。
【问题讨论】:
-
我现在看到 Pandas 默认执行此操作,请参阅 documentation/examples。但我不知道如何抑制...
-
只是为了记录,“左侧的标签”是系列名称。从代码中可能很明显,但我想留下这个评论可能有助于谷歌帮助我们所有人和其他人在未来找到这个答案。
标签: python pandas matplotlib charts pie-chart