首先,
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
