生活随笔
收集整理的這篇文章主要介紹了
pyecharts简单使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
pyecharts 是一個用于生成 Echarts 圖表的類庫。
Echarts 是百度開源的一個數據可視化 JS 庫。可以生成很多效果很棒的圖表。
pycharts文檔 |分割| echarts官網
本文主要介紹pycharts的簡單使用
$ pip install pyecharts
-U
from pyecharts
import options
as opts
from pyecharts
.charts
import Barx
= ['haha', 'hahaha', 'hahahaha', 'hehe', 'hehehe', 'hehehehe']y1
= [56, 90, 68, 56, 34, 9]y2
= [3, 45, 45, 67, 8, 45]c
= (Bar
().add_xaxis
(x
) .add_yaxis
("第一個柱狀圖", y1
).add_yaxis
("第二個柱狀圖", y2
).set_global_opts
(title_opts
=opts
.TitleOpts
(title
="Bar-大標題", subtitle
="Bar-副標題")) .render
("filename.html") )
生成的示例圖
def bar3d_base():name
= "這是一個3D柱狀圖"num
= 15c
= (Bar3D
(init_opts
=opts
.InitOpts
(width
="1600px", height
="800px")).add
(series_name
="hahaha",data
=data1
,xaxis3d_opts
=opts
.Axis3DOpts
(type_
="category", name
="時間"),yaxis3d_opts
=opts
.Axis3DOpts
(type_
="category", name
="id"),zaxis3d_opts
=opts
.Axis3DOpts
(type_
="value", name
="次數"),).add
(series_name
="hehehe",data
=data2
,xaxis3d_opts
=opts
.Axis3DOpts
(type_
="category", name
="時間"),yaxis3d_opts
=opts
.Axis3DOpts
(type_
="category", name
="id"),zaxis3d_opts
=opts
.Axis3DOpts
(type_
="value", name
="次數"),).set_global_opts
(visualmap_opts
=opts
.VisualMapOpts
(max_
=num
,range_color
=["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026",],),title_opts
=opts
.TitleOpts
(title
=name
),).render
('filename.html') )
生成的示例圖
總結
以上是生活随笔為你收集整理的pyecharts简单使用的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。