三人成虎造句【Python绘图】pyecharts绘制南丁格尔玫瑰图
from pyecharts.charts import Pie打针的故事
from pyecharts import options as opts
import random
# 随机颜⾊⽣成
def randomcolor(kind):
colors =[]
for i in range(kind):
colArr =['1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
color =""
for i in range(6):
磅礴读音营口鲅鱼圈color += colArr[random.randint(0,14)]
colors.append("#"+ color)
return colors
# 数据
provinces =['西藏','青海','贵州','江苏','新疆','内蒙古','海南',
'吉林','重庆','⼭西','安徽','江西','河北','湖南','宁夏','河南','云南','湖北']
num =[51,44,33,31,31,31,30,26,25,25,23,22,22,22,17,9,4,3]
color_ries = randomcolor(len(provinces))
# 创建饼图
fig = Pie(init_opts=opts.InitOpts(width='700px', height='900px'))
# 添加数据
fig.add("",[list(z)for z in zip(provinces, num)],
radius=['30%','135%'],
center=['50%','65%'],
赫鲁晓夫秘密报告rotype='area')
# 设置全局配置
fig.t_global_opts(title_opts=opts.TitleOpts(title='南丁格尔玫瑰图'),
legend_opts=opts.LegendOpts(is_show=Fal)
)
# 设置系列配置和颜⾊
fig.t_ries_opts(label_opts=opts.LabelOpts(is_show=True, position='inside', font_size=12,
formatter='{b}:{c}天', font_style='italic', font_weight='bold',
冬至活动方案
公关策略font_family='Microsoft YaHei'))# b:province;c:num
fig.t_colors(color_ries)
# 在⽹页⽣成照⽚爷爷亲奶奶亲