import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
# 饼图标签
kinds = ['童装', '奶粉辅食', '孕妈专区', '洗护喂养', '宝宝尿裤',
'春夏新品', '童车童床', '玩具文娱', '童鞋']
# 饼图的数据
sales = np.array([29665, 3135.4, 4292.4, 5240.9, 5543.4,
5633.8, 6414.5, 9308.1, 10353])
sales_total = np.sum(sales)
sales_scale = [i/sales_total for i in sales]
# 表格数据
cell_text = [29665, 3135.4, 4292.4, 5240.9, 5543.4,
5633.8, 6414.5, 9308.1, 10353]
# 绘制饼图
plt.pie(sales_scale, autopct='%3.1f%%')
plt.title('拼多多平台子类目的销售额')
plt.legend(kinds, loc='upper right', bbox_to_anchor=[1.7, 1.0], ncol=2)
# 添加表格
plt.table(cellText=[cell_text],
cellLoc='center',
rowLabels=['销售额(亿)'],
colLabels=kinds,
loc='lower center')
plt.show()
拼多多平台子类目的销售额(定制饼图)
最新推荐文章于 2024-08-16 18:55:06 发布