赞
踩
全局配置项可通过 set_global_opts 方法设置
笔记仅是个人的学习笔记总结,如有雷同请见谅
用法如下:
1.写入数据
# 导入包
from pyecharts.charts import Bar
# Faker可以帮助我们生成一些数据
from pyecharts.faker import Faker
from pyecharts import options as opts
bar = Bar()
# choose可以帮助我们在Faker中随机的生成一些数据,不用自己手动写入数据
bar.add_xaxis(Faker.choose())
# values可以帮助我们在Faker中随机的生成一些数据,不用自己手动写入数据
bar.add_yaxis("",Faker.values())
# 生成图表
bar.render_notebook()
2.使用set_global_opts来加入数据
1.bar.set_global_opts(title_opts=opts.TitleOpts(title="1级",subtitle='2级',title_link='https://www.baidu.com/'))
2.bar.set_global_opts(xaxis_opts=opts.AxisOpts(is_show=True,min_=-2,max_=8))
3.bar.set_global_opts(yaxis_opts=opts.AxisOpts(max_=40))
3.结果如下:
bar.set_global_opts(title_opts=opts.TitleOpts(title="1级",subtitle='2级',title_link='https://www.baidu.com/'))
from pyecharts.charts import Bar
from pyecharts.faker import Faker
from pyecharts import options as opts
bar = Bar()
bar.add_xaxis(Faker.choose())
bar.add_yaxis("",Faker.values())
bar.set_global_opts(title_opts=opts.TitleOpts(title="1级",subtitle='2级',title_link='https://www.baidu.com/'))
bar.render_notebook()
bar.set_global_opts(xaxis_opts=opts.AxisOpts(is_show=True,min_=-1,max_=7))
from pyecharts.charts import Bar
from pyecharts.faker import Faker
from pyecharts import options as opts
bar = Bar()
bar.add_xaxis(Faker.choose())
bar.add_yaxis("",Faker.values())
bar.set_global_opts(xaxis_opts=opts.AxisOpts(is_show=True,min_=-2,max_=8))
bar.render_notebook()
bar.set_global_opts(yaxis_opts=opts.AxisOpts(max_=40))
from pyecharts.charts import Bar
from pyecharts.faker import Faker
from pyecharts import options as opts
bar = Bar()
bar.add_xaxis(Faker.choose())
bar.add_yaxis("",Faker.values())
bar.set_global_opts(yaxis_opts=opts.AxisOpts(max_=40))
bar.render_notebook()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。