【发布时间】:2020-11-11 22:57:57
【问题描述】:
我有一个这样的数据框 df:
product count Class
stuff 3 A
thing 7 A
another 1 B
我可以用我的代码制作 2 个不同的饼图:
my_data = df['count']
my_labels = df['Product']
plt.pie(my_data,labels=my_labels,autopct='%1.1f%%')
plt.title('Distribution 1')
plt.axis('equal')
plt.show()
my_data = df['count']
my_labels = df['Class']
plt.pie(my_data,labels=my_labels,autopct='%1.1f%%')
plt.title('Distribution 2')
plt.axis('equal')
plt.show()
但我想做一个可以结合两者的嵌套馅饼:
当我检查https://matplotlib.org/3.1.1/gallery/pie_and_polar_charts/nested_pie.html 我不明白如何不使用静态值。
【问题讨论】: