pyecharts初步認識


pyecharts:

      Echarts 是一個由百度開源的數據可視化,憑借着良好的交互性,精巧的圖表設計,得到了眾多開發者的認可。而 Python 是一門富有表達力的語言,很適合用於數據處理。當數據分析遇上數據可視化時,pyecharts 誕生了。

   

版本

v0.5.X 和 V1.0.X 間完全不兼容,V1.0.X 是一個全新的版本,詳見 ISSUE#892

V0.5.X

支持 Python2.7,3.4+

經開發團隊決定,0.5.x 版本將不再進行維護,0.5.x 版本代碼位於 05x 分支,文檔位於 05x-docs.pyecharts.org

V1.0.X

僅支持 Python3.6+

新版本系列將從 v1.0.0 開始,文檔位於 pyecharts.org

🔰 安裝

pip 安裝

# 安裝 1.0.x 以上版本 $ pip install pyecharts -U # 如果需要安裝 0.5.11 版本的開發者,可以使用 # pip install pyecharts==0.5.11

源碼安裝

$ git clone https://github.com/pyecharts/pyecharts.git
$ cd pyecharts
$ pip install -r requirements.txt
$ python setup.py install

import pyecharts.options as opts
from pyecharts.charts import Line, Page

C = Collector()

def test1():
    
    bar = (
        Bar()
        .add_xaxis(["襯衫", "毛衣", "領帶", "褲子", "風衣", "高跟鞋", "襪子"])
        .add_yaxis("商家A", [114, 55, 27, 101, 125, 27, 105])
        .add_yaxis("商家B", [57, 134, 137, 129, 145, 60, 49])
        .add_yaxis("商家C", [60, 124, 120, 65, 89, 90])
        .set_global_opts(title_opts=opts.TitleOpts(title="某商場銷售情況"))
    )
    bar.render(path='bar.html')

    line = (Line()
        .add_xaxis(["襯衫", "毛衣", "領帶", "褲子", "風衣", "高跟鞋", "襪子"])
        .add_yaxis("商家A", [114, 55, 27, 101, 125, 27, 105])
        .add_yaxis("商家B", [57, 134, 137, 129, 145, 60, 49])
        .set_global_opts(title_opts=opts.TitleOpts(title="Line-基本示例"))
        )
    line.render(path='line.html')

在1.0.0版本import方法為:

from pyecharts.charts import Line,BAR, Page

在0.5.X版本import方法為

from pyecharts import Bar,Line


更多參考:https://github.com/pyecharts/pyecharts


免責聲明!

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



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