zoukankan      html  css  js  c++  java
  • python之pyecharts

      文档:https://pyecharts.org/

    安装:

      

    pip install pyecharts

    示例:

    from pyecharts.charts import Bar
    from pyecharts import options as opts
    
    # V1 版本开始支持链式调用
    # 你所看到的格式其实是 `black` 格式化以后的效果
    # 可以执行 `pip install black` 下载使用
    bar = (
        Bar()
        .add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
        .add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
        .set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
        # 或者直接使用字典参数
        # .set_global_opts(title_opts={"text": "主标题", "subtext": "副标题"})
    )
    bar.render()
    
    # 不习惯链式调用的开发者依旧可以单独调用方法
    bar = Bar()
    bar.add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
    bar.add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
    bar.set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
    bar.render()

    常见问题:

      1.使用snapshot_selenium渲染图片的时候,发生错误

    selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to

      解决:

        原因是Chrome浏览器需要配置chromedriver

        1)打开浏览器输入chrome://version/ 查看chrome版本,

         2)访问网址:http://chromedriver.storage.googleapis.com/index.html  选择合适版本的driver, 下载即可

        3)下载完成之后, 解压文件到python的根目录下即可

      

  • 相关阅读:
    python中filter(),map()和reduce()的用法及区别
    Python中的单例模式的几种实现方式的及优化
    python标准库和第三方库的区别
    django和flask的区别
    wtforms
    protobuf学习
    人物FSM
    策略模式
    虚函数调用机制
    虚析构函数
  • 原文地址:https://www.cnblogs.com/xingxia/p/14237636.html
Copyright © 2011-2022 走看看