Python-pyecharts生成精确到市的地图

pyecharts生成精确到市的地图。这里统一设置值为100,可以简单的实现点亮去过的城市这一功能。

代码

from pyecharts import options as opts
from pyecharts.charts import Map
from pyecharts.globals import ThemeType
finished=["北京市", "天津市", "上海市", "重庆市"]#对应地图中的名字
citylist=[]
for each in finished:
    citylist.append([each,100])
map_data = (
    Map(init_opts=opts.InitOpts(theme=ThemeType.ROMANTIC))
    .add("中国地图", citylist, "china-cities")
    .set_global_opts(
        title_opts=opts.TitleOpts(title="中国地图"),
        visualmap_opts=opts.VisualMapOpts(max_=100),
    )
)
map_data.render("map.html")

By-Round Moon

猜你喜欢

转载自blog.csdn.net/qq_35339563/article/details/134024462