pyecharts画饼图,多图并列
BirIndex = ['异常值率','正常值率']
BirValue = [12.18,87.82]
pieBir = Pie(init_opts=opts.InitOpts(width='800px',height='400px'))
pieBir.add(series_name='出生日期',data_pair = [list(z) for z in zip(BirIndex,BirValue)], center=[200, 300],radius=[80,160])
pieBir.set_global_opts(title_opts=opts.TitleOpts(title="出生日期整体情况",subtitle='单位:1/100'),
legend_opts=opts.LegendOpts(pos_left="0%",pos_top="55",orient='vertical'))
pieBir.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {d}"))
BirIndexE = ['缺失值率','自身异常值率','验证异常值率']
BirValueE = [0.03,10.00,2.15]
pieBirE = Pie(init_opts=opts.InitOpts(width='700px',height='300px'))
pieBirE.add(series_name='出生日期异常值',data_pair = [list(z) for z in zip(BirIndexE,BirValueE)],center=[650, 300],radius=[70,140]) #饼图圆心位置
pieBirE.set_global_opts(title_opts=opts.TitleOpts(title="出生日期异常值情况",subtitle='单位:1/100',pos_right='0'), #标题位置
legend_opts=opts.LegendOpts(pos_right="0%",pos_top="55",orient='vertical',align='right')) #图例位置
pieBirE.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {d}"))
grid = Grid()
grid.add(pieBir, grid_opts=opts.GridOpts(pos_right="5%"))
grid.add(pieBirE, grid_opts=opts.GridOpts(pos_left="95%"))
grid.render_notebook()
注:多图需要调整每个图的位置,grid.add(pieBir, grid_opts=opts.GridOpts(pos_right=“5%”))调整位置失灵(不知道原因?),通过center=[200, 300]来调整各图的位置