我正在尝试创建一个热图,显示早上6点到9点的用户模式。从https://gis.stackexchange.com/questions/341004/folium-plugins-heatmapwithtime-no-longer-produces-an-output?newreg=90f7365b57ec4a638c16c1e97739c04a开始,这个人经历了与底图完全相同的问题,但并没有动态热图。他们通过更新folium版本解决了这个问题。我已升级到folium 0.10.1,但仍然无法工作
我已经用我的代码和示例https://www.kaggle.com/daveianhickey/how-to-folium-for-maps-heatmaps-time-data#Heatmap-with-time-series中的代码尝试过了,但仍然不起作用
这是我的密码:
map_hooray = folium.Map(
location=[22.500605, 17.036672],
zoom_start=13
)
heat_data = [[[row['lat'], row['lon']] for index, row in df[df['hour'] == i].iterrows()] for i in range(5, 8)]
hm = plugins.HeatMapWithTime(heat_data,
min_opacity=0.1,
gradient={0.3: 'blue', 0.5: 'lime', 0.7: 'orange', 0.9: '#FC3800', 1: 'red'}
)
hm.add_to(map_hooray)
map_hooray
我的df看起来像:
lat lon hour
date
2020-01-01 05:44:33 46.33 23.33 6
2020-01-01 05:12:33 56.33 43.33 7
2020-01-01 07:34:33 66.33 53.33 7
2020-01-01 08:45:33 16.33 53.33 7
2020-01-01 09:38:33 36.33 63.33 8
提前谢谢
感谢https://github.com/python-visualization/folium/issues/1221
渲染函数中的内置heat_map_with time.py文件 替换
https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js
与
https://cdn.jsdelivr.net/npm/leaflet-timedimension@1.1.0/dist/leaflet.timedimension.min.js
一切正常。这是因为传单最近更新了
相关问题 更多 >
编程相关推荐