实验目的
    1、熟悉 pyecharts 组件的原理
    2、熟悉 pyecharts 组件的使用步骤
    3、掌握 pycharts 组件不同可视化图形的主要参数
    实验环境
    1、64 位电脑,8G 以上内存
    2、win10 系统
    3、Pyecharts 组件
    实验步骤:
    1. 安装 pyecharts 组件
    提示符:pip instatll pyecharts
    2. 创建第一个图表

    1. from pyecharts.charts import Bar
    2. bar=Bar()
    3. bar.add_xaxis(["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"])
    4. bar.add_yaxis("商家A",[5,20,36,10,75,90])
    5. bar.render()

    在程序所在目录找到 render.html,用浏览器打开,查看结果。
    image.png
    3. 使用 Option 配置项

    1. from pyecharts.charts import Bar
    2. from pyecharts import options as opts
    3. bar=Bar()
    4. bar.add_xaxis(["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"])
    5. bar.add_yaxis("商家A",[5,20,36,10,75,90])
    6. bar.set_global_opts(title_opts=opts.TitleOpts(title="主标题",subtitle="副标题"))
    7. bar.render()

    image.png
    4. 使用主题:

    1. from pyecharts.charts import Bar
    2. from pyecharts import options as opts
    3. from pyecharts.globals import ThemeType
    4. bar=(
    5. Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT))
    6. .add_xaxis(["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"])
    7. .add_yaxis("商家A",[5,20,36,10,75,90])
    8. .add_yaxis("商家B",[15,6,45,20,35,66])
    9. .set_global_opts(title_opts=opts.TitleOpts(title="主标题",subtitle="副标题"))
    10. )
    11. bar.render()

    image.png