from pyecharts import options as opts
from pyecharts.charts import Map
import numpy as np
import json
import webbrowser
from pyecharts.charts import Map
with open('./jn.json','r',encoding='utf-8') as f:
j = json.load(f)
c = (
Map()
.add_js_funcs("echarts.registerMap('jinan', {});".format(j))#注册地图
.add("济南",[('历下区',0.370581049278735),('市中区',0.12621594627494),('槐荫区',0.317378683112236),('天桥区',0.192282353809544),('历城区',0.253381390251034),('长清区',0.129590123843087),('章丘区',0.124900744718288),('济阳区',0.125732808846052),('莱芜区',0.0914918303036126),('钢城区',0.106898123879445),('平阴县',0.105863307621209),('商河县',0.103658054837092),('高新区1',0.694892492909691),('高新区2',0.694892492909691),('高新区3',0.694892492909691),('高新区4',0.694892492909691),('起步区',0.221933750373041),('南部山区',0.0910922059060405)], "jinan")
.set_global_opts(
title_opts=opts.TitleOpts(title="济南地图"), visualmap_opts=opts.VisualMapOpts(max_=1)
)
.render("jinan.html")
)
# c.render_notebook()
webbrowser.open('jinan.html')
分区县热力图显示 自定义json
本文介绍了如何使用Python库pyecharts创建交互式地图,展示济南各个区域的数据分布,并通过JSON文件导入地理信息,实现可视化效果。
摘要由CSDN通过智能技术生成