Pyecharts快速上手

In [18]: from pyecharts.charts import Bar

In [19]: from pyecharts import options as opts

In [21]: from pyecharts.globals import ThemeType

In [22]: bar = (
    ...: Bar(init_opts = opts.InitOpts(theme = ThemeType.LIGHT)) #设置
    ...: 初始主题
    ...: .add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜
    ...: 子"])
    ...: .add_yaxis('商家A',[5,20,36,10,75,90])
    ...: .add_yaxis('商家B',[15,6,45,20,35,66])
    ...: .set_global_opts(title_opts =opts.TitleOpts(title = "主标题",s
    ...: ubtitle = "副标题")) #option配置项
    ...: )

In [24]: from pyecharts.render import make_snapshot

In [25]: from snapshot_selenium import snapshot

In [28]: make_snapshot(snapshot,bar.render(),"bar.png") #保存为图片

DevTools listening on ws://127.0.0.1:46027/devtools/browser/b061258d-d996-4741-950e-5c7ee584e776

Pyecharts快速上手_第1张图片

Pyecharts快速上手_第2张图片

 

你可能感兴趣的:(Python)