diff --git a/docs/user_guide/plugins/heatmap_with_time.md b/docs/user_guide/plugins/heatmap_with_time.md index 956759a513..6536e41f38 100644 --- a/docs/user_guide/plugins/heatmap_with_time.md +++ b/docs/user_guide/plugins/heatmap_with_time.md @@ -74,3 +74,19 @@ hm.add_to(m) m ``` + +### Drawing on top of image overlays + +Image overlays cover the heatmap by default, even when the heatmap is added later. To draw the heatmap on top, put it in a custom pane with a higher `z_index`. + +```{code-cell} ipython3 +m = folium.Map([48.0, 5.0], zoom_start=6) + +folium.map.CustomPane("heatmap", z_index=450).add_to(m) + +hm = folium.plugins.HeatMapWithTime(data, pane="heatmap") + +hm.add_to(m) + +m +``` diff --git a/folium/plugins/heat_map_withtime.py b/folium/plugins/heat_map_withtime.py index 9f62fb4b31..bf0ee43be1 100644 --- a/folium/plugins/heat_map_withtime.py +++ b/folium/plugins/heat_map_withtime.py @@ -54,12 +54,31 @@ class HeatMapWithTime(JSCSSMixin, Layer): Whether the Layer will be included in LayerControls. show: bool, default True Whether the layer will be shown on opening. + pane: str, default "overlayPane" + Name of the map pane the heatmap is drawn in. Use a + :class:`folium.map.CustomPane` with a higher ``z_index`` to draw the + heatmap on top of image overlays, which otherwise cover it. """ _template = Template(""" {% macro header(this, kwargs) %}