转载自
https://blog.csdn.net/wsp_1138886114/article/details/80509375#%E4%B8%83-%E5%9C%B0%E5%9B%BEpyecharts%E5%9C%B0%E5%9B%BE%E6%95%B0%E6%8D%AE%E6%8E%A5%E5%8F%A3
安装这块稍作修改,否则有可能出现版本的问题
镜像安装下列地图数据包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyecharts==0.1.9.4
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyecharts==1.7.1
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-countries-pypkg
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-provinces-pypkg
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-cities-pypkg
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-counties-pypkg
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-misc-pypkg
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-united-kingdom-pypkg
▶代码1:
from pyecharts import Map
value = [155,10,66,78]
attr = ['福建','山东','北京','上海']
map = Map('全国地图示例',width = 1200,height = 600)
#加载中国地图
map.add('',attr,value,maptype = 'china')
map.render('./html/map01.html')
▶代码2:
from pyecharts import Map
value = [155,10,66,78]
attr = ['汕头市','汕尾市','揭阳市','肇庆市']
map = Map('广东地图示例',width = 1200,height = 600)
map.add('',attr,value,maptype = '广东',
is_visualmap = True,
visual_text_color = '#000',
is_label_show = True
)
map.render('./html/map02.html')