python可视化来分析冠状病毒疫情

废话不多说直接上代码

from pyecharts import options as opts
from pyecharts.charts import Geo
from pyecharts.globals import ChartType, SymbolType
import requests
import json
res = json.loads(requests.get('http://www.dzyong.top:3005/yiqing/province/').text)
print(res)
province = [p['provinceName'] for p in res['data']]
val1 = [p['confirmedNum'] for p in res['data']]
val2 = [p['curesNum'] for p in res['data']]
val3 = [p['deathsNum'] for p in res['data']]
geo = Geo()
geo.add_schema(maptype="china")
geo.add(
    "geo",
    [list(z) for z in zip(province, val1)],
    type_=ChartType.EFFECT_SCATTER,
)

geo.set_series_opts(label_opts=opts.LabelOpts(is_show=False, background_color='black', color='green'))
geo.set_global_opts(
    visualmap_opts=opts.VisualMapOpts(is_piecewise=True, min_=0, max_=30000),
    title_opts=opts.TitleOpts(title="全国疑似冠状病毒患者"))
geo.render('全国疑似冠状病毒患者.html')

python可视化来分析冠状病毒疫情_第1张图片
python可视化来分析冠状病毒疫情_第2张图片

python可视化来分析冠状病毒疫情_第3张图片

你可能感兴趣的:(编程,python,可视化)