系统需求:
编程语言: Python3
第三方库: pyecharts/echarts-countries-pypkg/echarts-china-provinces-pypkg/echarts-china-cities-pypkg/echarts-china-counties-pypkg/echarts-china-misc-pypkg
from pyecharts.charts import Map
from pyecharts import options as opts
ny_number = 0
other_number = 3
ny_location = ["宛城区", "卧龙区", "南召县", "方城县", "西峡县", "镇平县", "内乡县",
"淅川县", "社旗县", "唐河县", "新野县", "桐柏县", "邓州市"]
number_patient = [12, 13, 2, 2, 1, 3, 0,
1, 5, 9, 7, 12, 14]
for i in number_patient:
ny_number += i
all_number = ny_number + other_number
ny_list = [[ny_location[i], number_patient[i]] for i in range(len(ny_location))]
ny_map = Map()
ny_map.set_global_opts(
title_opts=opts.TitleOpts(title="南阳市新型冠状病毒疫情分布地图 "
"共计: {0}例(包含邓州市14例), 市内: {1}例, 外省进入: {2}例".format(all_number, ny_number, other_number)),
visualmap_opts=opts.VisualMapOpts(max_=50, is_piecewise=True,
pieces=[
{"max": 50, "min": 21, "label": "21-50", "color": "#840611"},
{"max": 20, "min": 9, "label": "9-20", "color": "#c50719"},
{"max": 8, "min": 5, "label": "5-8", "color": "#f41f33"},
{"max": 4, "min": 2, "label": "2-4", "color": "#f76e7a"},
{"max": 1, "min": 1, "label": "1", "color": "#fab8be"},
{"max": 0, "min": 0, "label": "0", "color": "#ffffff"},
]
)
)
ny_map.add("", ny_list, maptype="南阳")
ny_map.render("南阳疫情地图.html")
2020-02-02南阳疫情分布地图
2020-02-01南阳疫情分布地图
2020-02-02 疫情数据来源
2020-02-02 疫情数据来源
2020-02-01 疫情数据来源
持续更新中…