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

发布了101 篇原创文章 · 获赞 46 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/weixin_40539952/article/details/104231772
今日推荐