当前位置:网站首页>05 pyechars basic chart (example code + effect diagram)
05 pyechars basic chart (example code + effect diagram)
2022-07-28 12:52:00 【Lazy smile】
Catalog
7 Parallel Parallel coordinate system
1 Pie The pie chart
# Add QQ Let's discuss and study together : Lazy smile -Python Learn to exchange information sharing group 732481539
from pyecharts.charts import Pie
cate = ['1 month ', '2 month ', '3 month ', '4 month ', '5 month ', '6 month ']
data = [1123, 1153, 1089, 1207, 1298, 1123]
pie = (Pie()
.add('', [list(z) for z in zip(cate, data)])
)
pie.render("pie.html")
2 Funnel Funnel diagram
from pyecharts.charts import Funnel
cate = [' Browse ', ' Check the details ', ' Add to cart ', ' Buy ', ' refund ']
data = [33445, 11223, 5566, 443, 32]
funnel = (Funnel()
.add("", [list(z) for z in zip(cate, data)])
)
funnel.render("funnel.html")
3 Gauge The dashboard
# Add QQ Let's discuss and study together : Lazy smile -Python Learn to exchange information sharing group 732481539
from pyecharts.charts import Gauge
gauge = (Gauge()
.add(" temperature ", [('', 38)])
)
gauge.render("gauge.html")
4 Liquid Water polo
from pyecharts.charts import Liquid
liquid = (Liquid()
.add("", [0.70, 0.10])
)
liquid.render("liquid.html")
5 Calendar Calendar chart
# Add QQ Let's discuss and study together : Lazy smile -Python Learn to exchange information sharing group 732481539
import math
import datetime
from pyecharts import options as opts
from pyecharts.charts import Calendar
begin = datetime.date(2022, 1, 1)
end = datetime.date(2022, 12, 31)
data = [[str(begin + datetime.timedelta(days=i)), abs(math.cos(i / 100)) * random.randint(1000, 1200)]
for i in range((end - begin).days + 1)]
calendar = (
Calendar()
.add("", data, calendar_opts=opts.CalendarOpts(range_="2022"))
)
calendar.render("calendar.html")
6 Graph The diagram
from pyecharts.charts import Graph
nodes = [
{"name": " node 1", "symbolSize": 1},
{"name": " node 2", "symbolSize": 2},
{"name": " node 3", "symbolSize": 3},
{"name": " node 4", "symbolSize": 4},
{"name": " node 5", "symbolSize": 5},
]
links = [{'source': ' node 1', 'target': ' node 2'},
{'source': ' node 1', 'target': ' node 4'},
{'source': ' node 2', 'target': ' node 1'},
{'source': ' node 3', 'target': ' node 4'},
{'source': ' node 3', 'target': ' node 2'},
{'source': ' node 4', 'target': ' node 1'},
{'source': ' node 5', 'target': ' node 1'},
{'source': ' node 5', 'target': ' node 4'},
]
graph = (
Graph()
.add("", nodes, links)
)
graph.render("graph.html")
7 Parallel Parallel coordinate system
from pyecharts.charts import Parallel
data = [
[' The Monkey King ', 68, 61, 63, 68, 62, 67, " pass "],
[' But the king bull ', 88, 81, 83, 88, 82, 87, " good "],
[' Pig eight quit ', 58, 51, 53, 58, 42, 37, " fail, "],
[' The goddess of the moon ', 78, 71, 73, 78, 72, 77, " secondary "],
[' ruban ', 98, 91, 123, 98, 92, 97, " good "],
]
parallel = (
Parallel()
.add_schema(
[
opts.ParallelAxisOpts(
dim=0,
name=" class ",
type_="category",
data=[" The Monkey King ", " But the king bull ", " Pig eight quit ", " The goddess of the moon ", " ruban "],
),
opts.ParallelAxisOpts(dim=1, name=" English "),
opts.ParallelAxisOpts(dim=2, name=" mathematics "),
opts.ParallelAxisOpts(dim=3, name=" Chinese language and literature "),
opts.ParallelAxisOpts(dim=4, name=" Physics "),
opts.ParallelAxisOpts(dim=5, name=" biological "),
opts.ParallelAxisOpts(dim=6, name=" chemical "),
opts.ParallelAxisOpts(
dim=7,
name=" The rating ",
type_="category",
data=[" good ", " good ", " qualified "],
),
]
)
.add("", data)
)
parallel.render("parallel.html")8 Polar Polar system
from pyecharts.charts import Polar
cate = ['1 month ', '2 month ', '3 month ', '4 month ', '5 month ', '6 month ']
data = [800, 953, 1089, 1207, 1400, 1123]
polar = (
Polar()
.add_schema(
radiusaxis_opts=opts.RadiusAxisOpts(data=cate, type_="category"),
)
.add(" Monthly consumption ", data, type_='bar')
)
polar.render('polar.html')9 Radar Radar map
from pyecharts.charts import Radar
data = [
[68, 61, 63, 68, 62, 67],
[88, 81, 83, 88, 82, 87],
[58, 51, 53, 58, 42, 37],
[78, 71, 73, 78, 72, 77],
[98, 91, 123, 98, 92, 97]
]
radar = (Radar()
.add_schema(schema=[
opts.RadarIndicatorItem(name=" Chinese language and literature ", max_=150),
opts.RadarIndicatorItem(name=" mathematics ", max_=150),
opts.RadarIndicatorItem(name=" English ", max_=150),
opts.RadarIndicatorItem(name=" Physics ", max_=100),
opts.RadarIndicatorItem(name=" biological ", max_=100),
opts.RadarIndicatorItem(name=" chemical ", max_=100),
]
)
.add('', data)
)
radar.render('radar.html')
10 Sunburst Sunrise chart
# Sunrise chart
from pyecharts.charts import Sunburst
data = [
{"name": " hunan ",
"children": [
{"name": " Changsha ",
"children": [
{"name": " Yuhua district ", "value": 55},
{"name": " Yuelu District ", "value": 34},
{"name": " The heart of heaven ", "value": 144},
{"name": " Furong district ", "value": 111},
{"name": " Kaifu District ", "value": 84},
{"name": " Wangcheng District ", "value": 99},
]},
{"name": " changde ",
"children": [
{"name": " Wuling district ", "value": 156},
{"name": " Dingcheng District ", "value": 134},
]},
{"name": " xiangtan ", "value": 87},
{"name": " zhuzhou ", "value": 23},
],
},
{"name": " hubei ",
"children": [
{"name": " wuhan ",
"children": [
{"name": " Hongshan district ", "value": 55},
{"name": " Donghu hi tech ", "value": 78},
{"name": " Jiangxia District ", "value": 34},
]},
{"name": " Ezhou ", "value": 67},
{"name": " xiangyang ", "value": 34},
],
},
{"name": " Taiwan ", "value": 235}
]
sunburst = (Sunburst()
.add("", data_pair=data)
)
sunburst.render('sunburst.html')
11 Sankey Sanguitu
from pyecharts.charts import Sankey
nodes = [
{"name": " visit "},
{"name": " Focus on "},
{"name": " pay "},
]
links = [
{"source": " visit ", "target": " Focus on ", "value": 150},
{"source": " Focus on ", "target": " pay ", "value": 60},
]
sankey = (
Sankey()
.add("", nodes, links)
)
sankey.render('sankey.html')
12 ThemeRiver River Map
from pyecharts.charts import ThemeRiver
cate = ['1 month ', '2 month ', '3 month ', '4 month ', '5 month ', '6 month ']
date_list = ["2022/6/{}".format(i + 1) for i in range(30)]
data = [[day, random.randint(10, 200), c] for day in date_list for c in cate]
river = (
ThemeRiver()
.add(
series_name=cate,
data=data,
singleaxis_opts=opts.SingleAxisOpts(type_="time")
)
)
river.render('river.html')
13 WordCloud Clouds of words
from pyecharts.charts import WordCloud
words = [
(" are you there ", 230),
(" Morning ", 124),
(" Good night, ", 436),
(" Did you have your meal? ", 255),
(" Study ", 247),
(" ha-ha ", 244),
(" Laugh to death ", 138),
(" attend class;class begins ", 184),
(" Hanpai ", 12),
(" Hug ", 165),
(" Homework ", 247),
(" Have a holiday ", 182),
(" gift ", 25),
(" baby ", 365),
(" today ", 173),
(" ha-ha ", 65),
]
wordCloud = (
WordCloud()
.add("", words)
)
wordCloud.render('wordCloud.html')
14 Table form
from pyecharts.components import Table
table = Table()
headers = ["City name", "Area", "Population", "Annual Rainfall"]
rows = [
["Brisbane", 5905, 1857594, 1146.4],
["Adelaide", 1295, 1158259, 600.5],
["Darwin", 112, 120900, 1714.7],
["Hobart", 1357, 205556, 619.5],
["Sydney", 2058, 4336374, 1214.8],
["Melbourne", 1566, 3806092, 646.9],
["Perth", 5386, 1554769, 869.4],
]
table.add(headers, rows)
table.render('table.html')边栏推荐
- SuperMap iclient3d for webgl to realize floating thermal map
- 通过Jenkins 拉取服务器代码 权限不足问题及其他注意事项
- Markdown concise grammar manual
- 机器学习实战-决策树-22
- Zurich Federal Institute of technology | reference based image super resolution with deformable attention transformer (eccv2022))
- SuperMap arsurvey license module division
- Siemens docking Leuze BPS_ 304i notes
- 线性分类器(CCF20200901)
- Baidu map API adds information window circularly. The window only opens at the last window position and the window information content is the same solution
- 机器学习基础-支持向量机 SVM-17
猜你喜欢
随机推荐
非标自动化设备企业如何借助ERP系统,做好产品质量管理?
C structure use
Is it overtime to be on duty? Take up legal weapons to protect your legitimate rights and interests. It's time to rectify the working environment
stm32 回环结构接收串口数据并处理
Solution to the binary tree problem of niuke.com
Leetcode: array
20220728 common methods of object class
Introduction to resttemplate
云原生—运行时环境
牛客网二叉树题解
Leetcode:704 binary search
Block reversal (summer vacation daily question 7)
DART 三维辐射传输模型申请及下载
快速读入
Insufficient permission to pull server code through Jenkins and other precautions
第九章 REST 服务安全
Custom paging tag 02 of JSP custom tag
MSP430 开发中遇到的坑(待续)
Which big model is better? Openbmb releases bmlist to give you the answer!
Design a thread pool











