pyecharts 是一個(gè)用于生成 Echarts 圖表的類庫期吓。
Echarts 是百度開源的一個(gè)數(shù)據(jù)可視化 JS 庫早歇。主要用于數(shù)據(jù)可視化。
安裝
pyecharts 兼容 Python2 和 Python3讨勤。目前版本為 0.1.2
pip install pyecharts
入門
首先開始來繪制你的第一個(gè)圖表
from pyecharts import Bar
bar = Bar("我的第一個(gè)圖表", "這里是副標(biāo)題")
bar.add("服裝", ["襯衫", "羊毛衫", "雪紡衫", "褲子", "高跟鞋", "襪子"], [5, 20, 36, 10, 75, 90])
bar.show_config()
bar.render()
guide-0
Tip: 可以按右邊的下載按鈕將圖片下載到本地
-
add()
主要方法箭跳,用于添加圖表的數(shù)據(jù)和設(shè)置各種配置項(xiàng) -
show_config()
打印輸出圖表的所有配置項(xiàng) -
render()
默認(rèn)將會(huì)在根目錄下生成一個(gè) render.html 的文件,支持 path 參數(shù)潭千,設(shè)置文件保存位置谱姓,如 render(r"e:\my_first_chart.html"),文件用瀏覽器打開刨晴。
默認(rèn)的編碼類型為 UTF-8屉来,在 Python3 中是沒什么問題的路翻,Python3 對中文的支持好很多。但是在 Python2 中茄靠,編碼的處理是個(gè)很頭疼的問題茂契,暫時(shí)沒能找到完美的解決方法,目前只能通過文本編輯器自己進(jìn)行二次編碼慨绳,我用的是 Visual Studio Code掉冶,先通過 Gbk 編碼重新打開,然后再用 UTF-8 重新保存儡蔓,這樣用瀏覽器打開的話就不會(huì)出現(xiàn)中文亂碼問題了郭蕉。
基本上所有的圖表類型都是這樣繪制的:
-
chart_name = Type()
初始化具體類型圖表。 -
add()
添加數(shù)據(jù)及配置項(xiàng)喂江。 -
render()
生成 .html 文件召锈。
圖表類型
因篇幅原因,這里只給出了每種圖表類型的示例(代碼 + 生成圖表)获询。詳細(xì)參數(shù)的介紹請參考項(xiàng)目 README.md 文檔
Bar(柱狀圖/條形圖)
from pyecharts import Bar
bar = Bar("標(biāo)記線和標(biāo)記點(diǎn)示例")
bar.add("商家A", attr, v1, mark_point=["average"])
bar.add("商家B", attr, v2, mark_line=["min", "max"])
bar.render()
bar-1
from pyecharts import Bar
bar = Bar("x 軸和 y 軸交換")
bar.add("商家A", attr, v1)
bar.add("商家B", attr, v2, is_convert=True)
bar.render()
bar-2
EffectScatter(帶有漣漪特效動(dòng)畫的散點(diǎn)圖)
from pyecharts import EffectScatter
v1 = [10, 20, 30, 40, 50, 60]
v2 = [25, 20, 15, 10, 60, 33]
es = EffectScatter("動(dòng)態(tài)散點(diǎn)圖示例")
es.add("effectScatter", v1, v2)
es.render()
effectscatter-0
es = EffectScatter("動(dòng)態(tài)散點(diǎn)圖各種圖形示例")
es.add("", [10], [10], symbol_size=20, effect_scale=3.5, effect_period=3, symbol="pin")
es.add("", [20], [20], symbol_size=12, effect_scale=4.5, effect_period=4,symbol="rect")
es.add("", [30], [30], symbol_size=30, effect_scale=5.5, effect_period=5,symbol="roundRect")
es.add("", [40], [40], symbol_size=10, effect_scale=6.5, effect_brushtype='fill',symbol="diamond")
es.add("", [50], [50], symbol_size=16, effect_scale=5.5, effect_period=3,symbol="arrow")
es.add("", [60], [60], symbol_size=6, effect_scale=2.5, effect_period=3,symbol="triangle")
es.render()
effectscatter-1
Funnel(漏斗圖)
from pyecharts import Funnel
attr = ["襯衫", "羊毛衫", "雪紡衫", "褲子", "高跟鞋", "襪子"]
value = [20, 40, 60, 80, 100, 120]
funnel = Funnel("漏斗圖示例")
funnel.add("商品", attr, value, is_label_show=True, label_pos="inside", label_text_color="#fff")
funnel.render()
funnel-0
Gauge(儀表盤)
from pyecharts import Gauge
gauge = Gauge("儀表盤示例")
gauge.add("業(yè)務(wù)指標(biāo)", "完成率", 66.66)
gauge.show_config()
gauge.render()
gauge-0
Geo(地理坐標(biāo)系)
from pyecharts import Geo
data = [
("海門", 9),("鄂爾多斯", 12),("招遠(yuǎn)", 12),("舟山", 12),("齊齊哈爾", 14),("鹽城", 15),
("赤峰", 16),("青島", 18),("乳山", 18),("金昌", 19),("泉州", 21),("萊西", 21),
("日照", 21),("膠南", 22),("南通", 23),("拉薩", 24),("云浮", 24),("梅州", 25)...]
geo = Geo("全國主要城市空氣質(zhì)量", "data from pm2.5", title_color="#fff", title_pos="center",
width=1200, height=600, background_color='#404a59')
attr, value = geo.cast(data)
geo.add("", attr, value, visual_range=[0, 200], visual_text_color="#fff", symbol_size=15, is_visualmap=True)
geo.show_config()
geo.render()
geo-0
from pyecharts import Geo
data = [("海門", 9), ("鄂爾多斯", 12), ("招遠(yuǎn)", 12), ("舟山", 12), ("齊齊哈爾", 14), ("鹽城", 15)]
geo = Geo("全國主要城市空氣質(zhì)量", "data from pm2.5", title_color="#fff", title_pos="center",
width=1200, height=600, background_color='#404a59')
attr, value = geo.cast(data)
geo.add("", attr, value, type="effectScatter", is_random=True, effect_scale=5)
geo.show_config()
geo.render()
geo-1
Graph(關(guān)系圖)
from pyecharts import Graph
nodes = [{"name": "結(jié)點(diǎn)1", "symbolSize": 10},
{"name": "結(jié)點(diǎn)2", "symbolSize": 20},
{"name": "結(jié)點(diǎn)3", "symbolSize": 30},
{"name": "結(jié)點(diǎn)4", "symbolSize": 40},
{"name": "結(jié)點(diǎn)5", "symbolSize": 50},
{"name": "結(jié)點(diǎn)6", "symbolSize": 40},
{"name": "結(jié)點(diǎn)7", "symbolSize": 30},
{"name": "結(jié)點(diǎn)8", "symbolSize": 20}]
links = []
for i in nodes:
for j in nodes:
links.append({"source": i.get('name'), "target": j.get('name')})
graph = Graph("關(guān)系圖-環(huán)形布局示例")
graph.add("", nodes, links, is_label_show=True, repulsion=8000, layout='circular', label_text_color=None)
graph.show_config()
graph.render()
graph-0
from pyecharts import Graph
import json
with open("..\json\weibo.json", "r", encoding="utf-8") as f:
j = json.load(f)
nodes, links, categories, cont, mid, userl = j
graph = Graph("微博轉(zhuǎn)發(fā)關(guān)系圖", width=1200, height=600)
graph.add("", nodes, links, categories, label_pos="right", repulsion=50, is_legend_show=False,
line_curve=0.2, label_text_color=None)
graph.show_config()
graph.render()

graph-2
Line(折線/面積圖)
from pyecharts import Line
attr = ["襯衫", "羊毛衫", "雪紡衫", "褲子", "高跟鞋", "襪子"]
v1 = [5, 20, 36, 10, 10, 100]
v2 = [55, 60, 16, 20, 15, 80]
line = Line("折線圖示例")
line.add("商家A", attr, v1, mark_point=["average"])
line.add("商家B", attr, v2, is_smooth=True, mark_line=["max", "average"])
line.show_config()
line.render()
line-0
line = Line("折線圖-階梯圖示例")
line.add("商家A", attr, v1, is_step=True, is_label_show=True)
line.show_config()
line.render()
line-2
line = Line("折線圖-面積圖示例")
line.add("商家A", attr, v1, is_fill=True, line_opacity=0.2, area_opacity=0.4, symbol=None)
line.add("商家B", attr, v2, is_fill=True, area_color='#000', area_opacity=0.3, is_smooth=True)
line.show_config()
line.render()
line-3
Liquid(水球圖)
from pyecharts import Liquid
liquid = Liquid("水球圖示例")
liquid.add("Liquid", [0.6])
liquid.show_config()
liquid.render()
liquid-0
from pyecharts import Liquid
liquid = Liquid("水球圖示例")
liquid.add("Liquid", [0.6, 0.5, 0.4, 0.3], is_liquid_animation=False, shape='diamond')
liquid.show_config()
liquid.render()
liquid-2
Map(地圖)
from pyecharts import Map
value = [155, 10, 66, 78, 33, 80, 190, 53, 49.6]
attr = ["福建", "山東", "北京", "上海", "甘肅", "新疆", "河南", "廣西", "西藏"]
map = Map("Map 結(jié)合 VisualMap 示例", width=1200, height=600)
map.add("", attr, value, maptype='china', is_visualmap=True, visual_text_color='#000')
map.show_config()
map.render()
map-1
from pyecharts import Map
value = [20, 190, 253, 77, 65]
attr = ['汕頭市', '汕尾市', '揭陽市', '陽江市', '肇慶市']
map = Map("廣東地圖示例", width=1200, height=600)
map.add("", attr, value, maptype='廣東', is_visualmap=True, visual_text_color='#000')
map.show_config()
map.render()
map-2
Parallel(平行坐標(biāo)系)
from pyecharts import Parallel
c_schema = [
{"dim": 0, "name": "data"},
{"dim": 1, "name": "AQI"},
{"dim": 2, "name": "PM2.5"},
{"dim": 3, "name": "PM10"},
{"dim": 4, "name": "CO"},
{"dim": 5, "name": "NO2"},
{"dim": 6, "name": "CO2"},
{"dim": 7, "name": "等級",
"type": "category", "data": ['優(yōu)', '良', '輕度污染', '中度污染', '重度污染', '嚴(yán)重污染']}
]
data = [
[1, 91, 45, 125, 0.82, 34, 23, "良"],
[2, 65, 27, 78, 0.86, 45, 29, "良"],
[3, 83, 60, 84, 1.09, 73, 27, "良"],
[4, 109, 81, 121, 1.28, 68, 51, "輕度污染"],
[5, 106, 77, 114, 1.07, 55, 51, "輕度污染"],
[6, 109, 81, 121, 1.28, 68, 51, "輕度污染"],
[7, 106, 77, 114, 1.07, 55, 51, "輕度污染"],
[8, 89, 65, 78, 0.86, 51, 26, "良"],
[9, 53, 33, 47, 0.64, 50, 17, "良"],
[10, 80, 55, 80, 1.01, 75, 24, "良"],
[11, 117, 81, 124, 1.03, 45, 24, "輕度污染"],
[12, 99, 71, 142, 1.1, 62, 42, "良"],
[13, 95, 69, 130, 1.28, 74, 50, "良"],
[14, 116, 87, 131, 1.47, 84, 40, "輕度污染"]
]
parallel = Parallel("平行坐標(biāo)系-用戶自定義指示器")
parallel.config(c_schema=c_schema)
parallel.add("parallel", data)
parallel.show_config()
parallel.render()
parallel-1
Pie(餅圖)
from pyecharts import Pie
attr = ["襯衫", "羊毛衫", "雪紡衫", "褲子", "高跟鞋", "襪子"]
v1 = [11, 12, 13, 10, 10, 10]
pie = Pie("餅圖示例")
pie.add("", attr, v1, is_label_show=True)
pie.show_config()
pie.render()
pie-0
from pyecharts import Pie
attr = ["襯衫", "羊毛衫", "雪紡衫", "褲子", "高跟鞋", "襪子"]
v1 = [11, 12, 13, 10, 10, 10]
v2 = [19, 21, 32, 20, 20, 33]
pie = Pie("餅圖-玫瑰圖示例", title_pos='center', width=900)
pie.add("商品A", attr, v1, center=[25, 50], is_random=True, radius=[30, 75], rosetype='radius')
pie.add("商品B", attr, v2, center=[75, 50], is_random=True, radius=[30, 75], rosetype='area',
is_legend_show=False, is_label_show=True)
pie.show_config()
pie.render()
pie-2
Polar(極坐標(biāo)系)
from pyecharts import Polar
radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
polar = Polar("極坐標(biāo)系-堆疊柱狀圖示例", width=1200, height=600)
polar.add("A", [1, 2, 3, 4, 3, 5, 1], radius_data=radius, type='barRadius', is_stack=True)
polar.add("B", [2, 4, 6, 1, 2, 3, 1], radius_data=radius, type='barRadius', is_stack=True)
polar.add("C", [1, 2, 3, 4, 1, 2, 5], radius_data=radius, type='barRadius', is_stack=True)
polar.show_config()
polar.render()
polar-3
from pyecharts import Polar
radius = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
polar = Polar("極坐標(biāo)系-堆疊柱狀圖示例", width=1200, height=600)
polar.add("", [1, 2, 3, 4, 3, 5, 1], radius_data=radius, type='barAngle', is_stack=True)
polar.add("", [2, 4, 6, 1, 2, 3, 1], radius_data=radius, type='barAngle', is_stack=True)
polar.add("", [1, 2, 3, 4, 1, 2, 5], radius_data=radius, type='barAngle', is_stack=True)
polar.show_config()
polar.render()
polar-4
Radar(雷達(dá)圖)
from pyecharts import Radar
schema = [
("銷售", 6500), ("管理", 16000), ("信息技術(shù)", 30000), ("客服", 38000), ("研發(fā)", 52000), ("市場", 25000)]
v1 = [[4300, 10000, 28000, 35000, 50000, 19000]]
v2 = [[5000, 14000, 28000, 31000, 42000, 21000]]
radar = Radar()
radar.config(schema)
radar.add("預(yù)算分配", v1, is_splitline=True, is_axisline_show=True)
radar.add("實(shí)際開銷", v2, label_color=["#4e79a7"], is_area_show=False)
radar.show_config()
radar.render()
radar-0
value_bj = [
[55, 9, 56, 0.46, 18, 6, 1], [25, 11, 21, 0.65, 34, 9, 2],
[56, 7, 63, 0.3, 14, 5, 3], [33, 7, 29, 0.33, 16, 6, 4]...]
value_sh = [
[91, 45, 125, 0.82, 34, 23, 1], [65, 27, 78, 0.86, 45, 29, 2],
[83, 60, 84, 1.09, 73, 27, 3], [109, 81, 121, 1.28, 68, 51, 4]...]
c_schema= [{"name": "AQI", "max": 300, "min": 5},
{"name": "PM2.5", "max": 250, "min": 20},
{"name": "PM10", "max": 300, "min": 5},
{"name": "CO", "max": 5},
{"name": "NO2", "max": 200},
{"name": "SO2", "max": 100}]
radar = Radar()
radar.config(c_schema=c_schema, shape='circle')
radar.add("北京", value_bj, item_color="#f9713c", symbol=None)
radar.add("上海", value_sh, item_color="#b3e4a1", symbol=None)
radar.show_config()
radar.render()
radar-1
Scatter(散點(diǎn)圖)
from pyecharts import Scatter
v1 = [10, 20, 30, 40, 50, 60]
v2 = [10, 20, 30, 40, 50, 60]
scatter = Scatter("散點(diǎn)圖示例")
scatter.add("A", v1, v2)
scatter.add("B", v1[::-1], v2)
scatter.show_config()
scatter.render()
scatter-0
pyecharts-0
from pyecharts import Scatter
scatter = Scatter("散點(diǎn)圖示例")
v1, v2 = scatter.draw("../images/pyecharts-0.png")
scatter.add("pyecharts", v1, v2, is_random=True)
scatter.show_config()
scatter.render()
pyecharts-1
WordCloud(詞云圖)
from pyecharts import WordCloud
name = ['Sam S Club', 'Macys', 'Amy Schumer', 'Jurassic World', 'Charter Communications',
'Chick Fil A', 'Planet Fitness', 'Pitch Perfect', 'Express', 'Home', 'Johnny Depp',
'Lena Dunham', 'Lewis Hamilton', 'KXAN', 'Mary Ellen Mark', 'Farrah Abraham',
'Rita Ora', 'Serena Williams', 'NCAA baseball tournament', 'Point Break']
value = [10000, 6181, 4386, 4055, 2467, 2244, 1898, 1484, 1112, 965, 847, 582, 555,
550, 462, 366, 360, 282, 273, 265]
wordcloud = WordCloud(width=1300, height=620)
wordcloud.add("", name, value, word_size_range=[20, 100])
wordcloud.show_config()
wordcloud.render()
wordcloud-0
wordcloud = WordCloud(width=1300, height=620)
wordcloud.add("", name, value, word_size_range=[30, 100], shape='diamond')
wordcloud.show_config()
wordcloud.render()
wordcloud-1
用戶自定義
用戶還可以自定義結(jié)合 Line/Bar 圖表
需使用 get_series()
和 custom()
方法
get_series()
""" 獲取圖表的 series 數(shù)據(jù) """
custom(series)
''' 追加自定義圖表類型 '''
- series -> dict
追加圖表類型的 series 數(shù)據(jù)
先用 get_series()
獲取數(shù)據(jù)涨岁,再使用 custom()
將圖表結(jié)合在一起
from pyecharts import Bar, Line
attr = ['A', 'B', 'C', 'D', 'E', 'F']
v1 = [10, 20, 30, 40, 50, 60]
v2 = [15, 25, 35, 45, 55, 65]
v3 = [38, 28, 58, 48, 78, 68]
bar = Bar("Line - Bar 示例")
bar.add("bar", attr, v1)
line = Line()
line.add("line", v2, v3)
bar.custom(line.get_series())
bar.show_config()
bar.render()
custom-0
更多示例
用極坐標(biāo)系畫出一個(gè)愛心
import math
from pyecharts import Polar
data = []
for i in range(101):
theta = i / 100 * 360
r = 5 * (1 + math.sin(theta / 180 * math.pi))
data.append([r, theta])
hour = [i for i in range(1, 25)]
polar = Polar("極坐標(biāo)系示例", width=1200, height=600)
polar.add("Love", data, angle_data=hour, boundary_gap=False,start_angle=0)
polar.show_config()
polar.render()
example-0
用極坐標(biāo)系畫出一朵小花
import math
from pyecharts import Polar
data = []
for i in range(361):
t = i / 180 * math.pi
r = math.sin(2 * t) * math.cos(2 * t)
data.append([r, i])
polar = Polar("極坐標(biāo)系示例", width=1200, height=600)
polar.add("Flower", data, start_angle=0, symbol=None, axis_range=[0, None])
polar.show_config()
polar.render()
example-1
還可以給小花涂上顏色
import math
from pyecharts import Polar
data = []
for i in range(361):
t = i / 180 * math.pi
r = math.sin(2 * t) * math.cos(2 * t)
data.append([r, i])
polar = Polar("極坐標(biāo)系示例", width=1200, height=600)
polar.add("Color-Flower", data, start_angle=0, symbol=None, axis_range=[0, None],
area_color="#f71f24", area_opacity=0.6)
polar.show_config()
polar.render()
example-1-1
用散點(diǎn)圖畫出一個(gè)愛心
from pyecharts import Scatter
scatter = Scatter("散點(diǎn)圖示例", width=800, height=480)
v1 ,v2 = scatter.draw("../images/love.png")
scatter.add("Love", v1, v2)
scatter.render()
example-2
用散點(diǎn)圖畫出一個(gè)火辣的 Bra
from pyecharts import Scatter
scatter = Scatter("散點(diǎn)圖示例", width=1000, height=480)
v1 ,v2 = scatter.draw("../images/cup.png")
scatter.add("Cup", v1, v2)
scatter.render()
example-3
用散點(diǎn)圖畫出一個(gè)性感的 Bra
from pyecharts import Scatter
scatter = Scatter("散點(diǎn)圖示例", width=1000, height=480)
v1 ,v2 = scatter.draw("../images/cup.png")
scatter.add("Cup", v1, v2, label_color=["#000"])
scatter.render()
example-4
某地最低溫和最高氣溫折線圖
from pyecharts import Line
attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日', ]
line = Line("折線圖示例")
line.add("最高氣溫", attr, [11, 11, 15, 13, 12, 13, 10], mark_point=["max", "min"], mark_line=["average"])
line.add("最低氣溫", attr, [1, -2, 2, 5, 3, 2, 0], mark_point=["max", "min"],
mark_line=["average"], yaxis_formatter="°C")
line.show_config()
line.render()
example-5
餅圖嵌套
from pyecharts import Pie
pie = Pie("餅圖示例", title_pos='center', width=1000, height=600)
pie.add("", ['A', 'B', 'C', 'D', 'E', 'F'], [335, 321, 234, 135, 251, 148], radius=[40, 55],is_label_show=True)
pie.add("", ['H', 'I', 'J'], [335, 679, 204], radius=[0, 30], legend_orient='vertical', legend_pos='left')
pie.show_config()
pie.render()
example-6
餅圖再嵌套
import random
from pyecharts import Pie
attr = ['A', 'B', 'C', 'D', 'E', 'F']
pie = Pie("餅圖示例", width=1000, height=600)
pie.add("", attr, [random.randint(0, 100) for _ in range(6)], radius=[50, 55], center=[25, 50],is_random=True)
pie.add("", attr, [random.randint(20, 100) for _ in range(6)], radius=[0, 45], center=[25, 50],rosetype='area')
pie.add("", attr, [random.randint(0, 100) for _ in range(6)], radius=[50, 55], center=[65, 50],is_random=True)
pie.add("", attr, [random.randint(20, 100) for _ in range(6)], radius=[0, 45], center=[65, 50],rosetype='radius')
pie.show_config()
pie.render()
example-7
某地的降水量和蒸發(fā)量柱狀圖
from pyecharts import Bar
attr = ["{}月".format(i) for i in range(1, 13)]
v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
bar = Bar("柱狀圖示例")
bar.add("蒸發(fā)量", attr, v1, mark_line=["average"], mark_point=["max", "min"])
bar.add("降水量", attr, v2, mark_line=["average"], mark_point=["max", "min"])
bar.show_config()
bar.render()
example-8
各類電影中"好片"所占的比例
from pyecharts import Pie
pie = Pie('各類電影中"好片"所占的比例', "數(shù)據(jù)來著豆瓣", title_pos='center')
pie.add("", ["劇情", ""], [25, 75], center=[10, 30], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None, )
pie.add("", ["奇幻", ""], [24, 76], center=[30, 30], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None, legend_pos='left')
pie.add("", ["愛情", ""], [14, 86], center=[50, 30], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None)
pie.add("", ["驚悚", ""], [11, 89], center=[70, 30], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None)
pie.add("", ["冒險(xiǎn)", ""], [27, 73], center=[90, 30], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None)
pie.add("", ["動(dòng)作", ""], [15, 85], center=[10, 70], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None)
pie.add("", ["喜劇", ""], [54, 46], center=[30, 70], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None)
pie.add("", ["科幻", ""], [26, 74], center=[50, 70], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None)
pie.add("", ["懸疑", ""], [25, 75], center=[70, 70], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None)
pie.add("", ["犯罪", ""], [28, 72], center=[90, 70], radius=[18, 24],
label_pos='center', is_label_show=True, label_text_color=None, is_legend_show=True, legend_top="center")
pie.show_config()
pie.render()
example-9
用極坐標(biāo)系畫出一個(gè)蝸牛殼
import math
from pyecharts import Polar
data = []
for i in range(5):
for j in range(101):
theta = j / 100 * 360
alpha = i * 360 + theta
r = math.pow(math.e, 0.003 * alpha)
data.append([r, theta])
polar = Polar("極坐標(biāo)系示例")
polar.add("", data, symbol_size=0, symbol='circle', start_angle=-25, is_radiusaxis_show=False,
area_color="#f3c5b3", area_opacity=0.5, is_angleaxis_show=False)
polar.show_config()
polar.render()
example-10