我有几个主题(两个)的句子列表,如下所示:
Sentences
Trump says that it is useful to win the next presidential election.
The Prime Minister suggests the name of the winner of the next presidential election.
In yesterday's conference, the Prime Minister said that it is very important to win the next presidential election.
The Chinese Minister is in London to discuss about climate change.
The president Donald Trump states that he wants to win the presidential election. This will require a strong media engagement.
The president Donald …
Run Code Online (Sandbox Code Playgroud) 我想知道我可以在饼图中添加标注吗?我有这个数据集:
ID Colour
0 27995 red
1 36185 orange
2 57204 blue
3 46009 red
4 36241 white
5 63286 blue
6 68905 blue
7 3798 green
8 53861 yellow
...
199 193 brown
Run Code Online (Sandbox Code Playgroud)
当我尝试使用 pandas 生成饼图时:
df.groupby(Colour).size().plot(kind='pie',figsize=(15,15), label="", labeldistance=0.8, autopct='%1.0f%%', pctdistance=0.5,legend=True)
Run Code Online (Sandbox Code Playgroud)
我得到了一个糟糕的图表,其中颜色重叠,因为切片非常小并且百分比值也重叠。我知道按如下方式管理图表可能会更容易:
如何避免 matplotlib 饼图中标签和 autopct 重叠?
但在我的案例中,我无法使用答案中的代码。
您能告诉我应该在该答案中建议的代码中更改哪些内容吗?