import matplotlib.pyplot as plt | |
# 数据准备 | |
labels = 'Female', 'Eunuch', 'Male' | |
sizes = [50, 30, 20] | |
colors = ['#ff7675', '#74b9ff', '#55efc4'] | |
# 绘制饼图 | |
plt.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', startangle=90) | |
# 添加标题 | |
plt.title('Pie Chart - Gender Distribution') | |
# 显示图形 | |
plt.show() | |