贵州省地图
#encoding=utf-8
#@Project filename:PythonDemo Map
#@IDE :PyCharm
#@Author :ganxiang
#@Date :2020/02/14 14:26
from pyecharts.charts import Map,Geo
from pyecharts import options as opts
# #贵州地图
# 数据只能是省名和直辖市的名称
city = ['贵阳市', '六盘水市', '安顺市', '毕节市', '黔西南布依族苗族自治州', '遵义市', '黔南布依族苗族自治州', '黔东南苗族侗族自治州']
values2 = [34, 10, 4, 23, 4, 28, 17, 10]
pr =[]
for x,y in zip(city,values2):
pr.append((x,y))
GuiZhouMap = (
Map()
.add("贵州地图",pr,maptype='贵州')
.set_colors(colors='#000')
.set_global_opts(toolbox_opts=opts.ToolboxOpts(),title_opts=opts.TitleOpts("GuiZhouMap"))
.render('./data/map-贵州地图.html')
)
from pyecharts.charts import Map,Geo
from pyecharts import options as opts
#中国地图
province = ['北京','辽宁','吉林','黑龙江','内蒙古','新疆','河北','河南','江西','上海','安徽','江苏','湖南','浙江','广东','海南',
'湖北','澳门','香港','台湾','山西','陕西','四川','贵州','云南','重庆','山东','福建','青海','天津','西藏']
chinese =[]
for m,n in zip(province,range(1,92,3)):
chinese.append((m,n))
print(chinese)
ChinaMap = {
Map()
.add('中国地图',chinese,maptype='china')
.set_global_opts(title_opts=opts.TitleOpts("ChinaMap"),toolbox_opts=opts.ToolboxOpts())
.render('./data/map-中国地图.html')
}