利用pyecharts做地图数据展示

首先,

pip install pyecharts

为了地图上的数据能显示完全,加载好需要的城市地理坐标数据。

pip install echarts-countries-pypkg

pip install echarts-china-provinces-pypkg

pip install echarts-china-cities-pypkg

pip install echarts-china-counties-pypkg

pip install echarts-china-misc-pypkg

pip install echarts-united-kingdom-pypkg

# 数据准备
areas = ['浙江', '广东', '四川', '福建', '江西', '河南', '湖北', '上海市', '吉林', '陕西', '江苏', '湖南', '黑龙江', '广西', '安徽', '山西', '海南'] 
values = [183, 63, 40, 29, 24, 16, 15, 13, 10, 10, 6, 5, 5, 3, 3, 1, 1]
# 画图 import numpy as np from pyecharts 

import Geo
test_geo
= Geo("****分布", "(限定**车)合计427", title_color="#fff", title_pos="center", width=800, height=400)
test_geo.use_theme(
'dark')
test_geo.add(
"",areas, values, maptype='china', is_visualmap=True, is_label_show=False, visual_type="size", border_color = '#fff') #画地图散点十分建议指定边界颜色为一个较亮的颜色
test_geo
#notebook上会直接显示,不行就加上.render() 然后在当前文件目录上找

参考
http://pyecharts.herokuapp.com/geo

https://github.com/pyecharts/pyecharts/blob/master/pyecharts/charts/geo.py

原文地址:https://www.cnblogs.com/andylhc/p/10281254.html