MCPcopy Create free account
hub / github.com/python-visualization/folium / HeatMap

Class HeatMap

folium/plugins/heat_map.py:17–122  ·  view source on GitHub ↗

Create a Heatmap layer Parameters ---------- data : list of points of the form [lat, lng] or [lat, lng, weight] The points you want to plot. You can also provide a numpy.array of shape (n,2) or (n,3). name : string, default None The name of the Layer, as

Source from the content-addressed store, hash-verified

15
16
17class HeatMap(JSCSSMixin, Layer):
18 """
19 Create a Heatmap layer
20
21 Parameters
22 ----------
23 data : list of points of the form [lat, lng] or [lat, lng, weight]
24 The points you want to plot.
25 You can also provide a numpy.array of shape (n,2) or (n,3).
26 name : string, default None
27 The name of the Layer, as it will appear in LayerControls.
28 min_opacity : default 1.
29 The minimum opacity the heat will start at.
30 max_zoom : default 18
31 Zoom level where the points reach maximum intensity (as intensity
32 scales with zoom), equals maxZoom of the map by default
33 radius : int, default 25
34 Radius of each "point" of the heatmap
35 blur : int, default 15
36 Amount of blur
37 gradient : dict, default None
38 Color gradient config. Defaults to
39 {.4: "blue", .6: "cyan", .7: "lime", .8: "yellow", 1: "red"}
40 overlay : bool, default True
41 Adds the layer as an optional overlay (True) or the base layer (False).
42 control : bool, default True
43 Whether the Layer will be included in LayerControls.
44 show: bool, default True
45 Whether the layer will be shown on opening.
46 """
47
48 _template = Template(
49 """
50 {% macro script(this, kwargs) %}
51 var {{ this.get_name() }} = L.heatLayer(
52 {{ this.data|tojson }},
53 {{ this.options|tojavascript }}
54 );
55 {% endmacro %}
56 """
57 )
58
59 default_js = [
60 (
61 "leaflet-heat.js",
62 "https://cdn.jsdelivr.net/gh/python-visualization/folium@main/folium/templates/leaflet_heat.min.js",
63 ),
64 ]
65
66 def __init__(
67 self,
68 data,
69 name=None,
70 min_opacity=0.5,
71 max_zoom=18,
72 radius=25,
73 blur=15,
74 gradient=None,

Callers 4

test_heat_mapFunction · 0.90
test_heatmap_dataFunction · 0.90
test_heat_map_exceptionFunction · 0.90

Calls 1

TemplateClass · 0.90

Tested by 4

test_heat_mapFunction · 0.72
test_heatmap_dataFunction · 0.72
test_heat_map_exceptionFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…