📜  如何在python代码示例中绘制饼图

📅  最后修改于: 2022-03-11 14:46:31.636000             🧑  作者: Mango

代码示例2
import matplotlib.pyplot as plt
import seaborn as sns

#define data
data = [value1, value2, value3, ...]
labels = ['label1', 'label2', 'label3', ...]

#define Seaborn color palette to use
colors = sns.color_palette('pastel')[0:5]

#create pie chart
plt.pie(data, labels = labels, colors = colors, autopct='%.0f%%')
plt.show()