pyecharts 學習筆記(5)


 

 

 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"
)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM