答案 0 :(得分:1)
我认为你需要稍微改动How to make MxN piechart plots with one legend and removed y-axis titles in Matplotlib:
df = pd.DataFrame({'beer':[1,2,3],
'spirit':[4,5,6],
'wine':[7,8,9]}, index=['Africa','Asia','Europe'])
print (df)
beer spirit wine
Africa 1 4 7
Asia 2 5 8
Europe 3 6 9
fig, axes = plt.subplots(1,3, figsize=(10,3))
for ax, idx in zip(axes, df.index):
ax.pie(df.loc[idx], labels=df.columns, autopct='%.2f')
ax.set(ylabel='', title=idx, aspect='equal')
axes[0].legend(bbox_to_anchor=(0, 0.5))
plt.show()