来自 folium.plugins 的热图未显示

HeatMap from folium.plugins doesn't show

我正在尝试用 folium 绘制热图。

我的代码:

import folium
from folium.plugins import HeatMap

base_location = (41.38861123888889, 2.1716497203703704)

m = folium.Map(
        location=base_location,
        zoom_start=13,
    )

# Some testing locs
locs = [
    [41.4257715, 2.1761088],
    [41.384546, 2.1638681],
    [41.3850111, 2.1658954],
    [41.3809043, 2.1734703],
    [41.3865159, 2.1709474],
    [41.3874418, 2.1706964],
    [41.3854827, 2.1700754],
    [41.3893763, 2.1728965],
    [41.3816256, 2.1748245],
    [41.3858352, 2.1943144]
]

HeatMap(locs).add_to(m)
m

但我的系统 returns 一张没有任何热图图层的地图。为什么??

我也尝试将地图保存到 html 中,并将位置显示为元组列表,但结果是一样的。

我解决了,我发现我公司的防火墙阻止了 github 来源。

我只是改heat_map.py:

    def render(self, **kwargs):
    super(HeatMap, self).render(**kwargs)

    figure = self.get_root()
    assert isinstance(figure, Figure), ('You cannot render this Element '
                                        'if it is not in a Figure.')

    figure.header.add_child(
        # Changed github source with any gitraw service alternative
        # JavascriptLink('https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js'),  # noqa
        JavascriptLink('https://rawcdn.githack.com/Leaflet/Leaflet.heat/5885ec0ec2442876b67725c64dc537cb12c52c73/dist/leaflet-heat.js'),  # noqa
        name='leaflet-heat.js')