Double line graph version comparison pyecharts

pyecharts update v1.0 you, the weapon is simply the number of water lines

A, v0.5.x version

Support 2.7,3.4+

def lineDraw(info):
    date, win, use = info[0], info[1], info[2]
    line = Line("胜率与使用率", background_color="#FFF")  # 默认背景颜色是黑的,需要重新配置一下,#FFF就是纯白
    line.add("胜率", date, win, label_color=["#FF0033", "#4169E1"], yaxis_formatter="%", is_smooth=True,
             is_fill=True, area_opacity=0.3, mark_line=["average"], mark_point=["max", "min"],
             mark_point_textcolor="#000")
    line.add("使用率", date, use, yaxis_formatter="%", is_smooth=True, is_fill=True,
             area_opacity=0.5, mark_line=["average"], mark_point=["max", "min"])
    line.render()
5516287-61c027da025540cd.jpeg

Two, v1.0 version

Support 3.6+, everything Jieke opts

def lineDraw(info):
    date, win, use = info[0], info[1], info[2]
    line = (
        Line(init_opts=opts.InitOpts(bg_color="white"))
        .add_xaxis(date)    # 增加x轴
        .add_yaxis("胜率", win, is_smooth=True,
                   areastyle_opts=opts.AreaStyleOpts(opacity=0.3), color="#4169E1")     # 增加y轴,设置曲线流畅,透明度,曲线颜色
        .add_yaxis("使用率", use, is_smooth=True,
                   areastyle_opts=opts.AreaStyleOpts(opacity=0.5), color="#FF0033")     # 增加y轴
        .set_global_opts(
            title_opts=opts.TitleOpts(title="胜率与使用率", subtitle="皮卡"),
            xaxis_opts=opts.AxisOpts(
                axistick_opts=opts.AxisTickOpts(is_align_with_label=True),
                is_scale=False,
                boundary_gap=False
            ),  # 图像贴近y轴
            yaxis_opts=opts.AxisOpts(splitline_opts=opts.SplitLineOpts(is_show=True))   # 增加y轴分割线
        )   # 全局配置项
        .set_series_opts(
            markpoint_opts=opts.MarkPointOpts(
                data=[opts.MarkPointItem(type_="max"), opts.MarkPointItem(type_="min")],
                symbol_size=[34, 30],
                label_opts=opts.LabelOpts(position="inside", color="#fff", font_size=8)
            ),
            label_opts=opts.LabelOpts(is_show=False),
            markline_opts=opts.MarkLineOpts(data=[opts.MarkLineItem(type_="average")])
        )   # 系列配置项
    )
    make_snapshot(snapshot, line.render(), outputfile)
5516287-2eff16ca433821d2.jpeg

Reproduced in: https: //www.jianshu.com/p/3cce8c0d9256

Guess you like

Origin blog.csdn.net/weixin_34137799/article/details/91159004