pyecharts 提供十分丰富的工具来是的展示更加完美。
接下来就是分别介绍不能功能函数的使用了
1. TitleOpts: 标题配置项
from pyecharts import options as opts from pyecharts.charts import Bar ( Bar() .add_xaxis( [ "名字很长的X轴标签1", "名字很长的X轴标签2", "名字很长的X轴标签3", "名字很长的X轴标签4", "名字很长的X轴标签5", "名字很长的X轴标签6", ] ) .add_yaxis("商家A", [10, 20, 30, 40, 50, 40]) .add_yaxis("商家B", [20, 10, 40, 30, 40, 50]) .set_global_opts( xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-15)), title_opts=opts.TitleOpts(title="Bar-旋转X轴标签", subtitle="解决标签名字过长的问题"), ) .render_notebook() )
from pyecharts import options as opts from pyecharts.charts import Bar from pyecharts.faker import Faker ( Bar() .add_xaxis(Faker.choose()) .add_yaxis("商家A", Faker.values()) .add_yaxis("商家B", Faker.values()) .set_global_opts( title_opts=opts.TitleOpts(title="Bar-Brush示例", subtitle="我是副标题"), brush_opts=opts.BrushOpts(),# 厉害的工具 ) .render_notebook()#"bar_with_brush.html" )