旭日图+热力地图
- 1.旭日图
- 2.热力地图(中国和世界)
-
- 2.1 2020年全国各省市GDP排名前十省市
- 2.2新冠肺炎累计确诊病例数最多的十个国家
1.旭日图
from pyecharts.charts import Sunburst
from pyecharts.faker import Faker
import pyecharts.options as opts
data=[
opts.SunburstItem(1000,name='三爷爷',children=[
opts.SunburstItem(1000,'李叔叔',children=[
opts.SunburstItem(200,'表哥李靖'),
opts.SunburstItem(800,'表妹李静')
])
], itemstyle_opts=opts.ItemStyleOpts(color='purple')
)
,
opts.SunburstItem(5000,name='爷爷',children=[
opts.SunburstItem(4000,'李叔叔',children=[
opts.SunburstItem(2000,'表哥李政',children=[opts.SunburstItem(1000,'表侄李佳')]
),
opts.SunburstItem(100,'表姐李诗'),
opts.SunburstItem(50,'表妹李诗诗')
]),
opts.SunburstItem(1000,'爸爸',children=[
opts.SunburstItem(200,'我'),
opts.SunburstItem(100,'哥哥李海')
]),
], itemstyle_opts=opts.ItemStyleOpts(color='blue')
)
]
s=(
Sunburst()
.add('',data,radius=['0%','100%'])
.set_global_opts(title_opts=opts.TitleOpts(title='家族成员层次分析',subtitle='(2021年6月)',pos_left='center'))
)
s.render_notebook()
2.热力地图(中国和世界)
2.1 2020年全国各省市GDP排名前十省市
list_shengshi= ['广东',
'江苏',
'山东',
'浙江',
'河南',
'四川',
'福建',
'湖北',
'湖南',
'上海']
list1_value = [110760.94,
102719,
73129,
64613,
54997.07,
48598.8,
43903.89,
43443.46,
41781.49,
38700.58]
data2={}
for i in range(len(list_shengshi)):
data2[list_shengshi[i]] = list1_value[i]
from pyecharts.charts import Map
import pyecharts.options as opts
m = (
Map()
.add('',list(data2.items()), 'china')
.set_series_opts(label_opts=opts.LabelOpts(is_show=True),is_selected = True)
.set_global_opts(
title_opts=opts.TitleOpts(title='2020年全国各省市GDP排名前十省市'),
visualmap_opts=opts.VisualMapOpts(min_=38700,max_=110762)
)
)
m.render_notebook()
2.2新冠肺炎累计确诊病例数最多的十个国家
countries = ['United States','India','Brazil' ,'France', 'Turkey', 'Russia', 'United Kingdom', 'Italy', 'Spain', 'Germany']
numbers = [32923938, 24684077,15586534,5863839,5106862,4875308,4464663 ,4153374,3604799,3595872]
data3 = list(zip(countries, numbers ))
from pyecharts.charts import Map
import pyecharts.options as opts
m = (
Map()
.add('',data3, 'world')
.set_series_opts(label_opts=opts.LabelOpts(is_show=False) , )
.set_global_opts(
title_opts=opts.TitleOpts(title='新冠肺炎累计确诊病例数最多的十个国家', subtitle='2021年6月20日'),
visualmap_opts=opts.VisualMapOpts(min_=0,max_=40000000,orient='horizontal', pos_left='center',is_piecewise=True
),
)
)
m.render_notebook()