【发布时间】:2020-09-02 11:52:36
【问题描述】:
文件由一些城市组和时间信息组成。我从 stackoverflow 周围的某个地方获取了一个代码并对其进行了一些更改:
fig, ax = plt.subplots(figsize=(8, 5.5), subplot_kw=dict(aspect="equal"))
wedges,texts, autotexts = ax.pie(File, autopct= '%1.1f%%',
textprops=dict(color="g"))
ax.legend(wedges, File.index,
title="Signatures", loc = 0, bbox_to_anchor=(-0.85, 1, 0.7, 0.35), ncol = 2
)
plt.setp(autotexts, size=6, weight="bold")
plt.tight_layout()
ax.set_title("Timing(%)")
2 个我仍未解决的问题: 首先,如何将顶级城市组名称(数量为 4 或 5)保留在饼图中,而不仅仅是在图例中? (但不是每个人......只有那些出现最多的人!)其次,我如何隐藏所有低于 10% 的百分比?我有 12-23 个组(几个图表),有时会覆盖“百分比文本”。
【问题讨论】:
标签: pandas matplotlib pie-chart figure