-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
The documentation for folium.plugins.HeatMap mentions that default gradient is None, but I found that Folium seems using the standard gradient color from leaflet, which from the source code is defined as (see leaflet_heat.min.js, or the dependency simpleheat.js):
defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"}To me is also not clear from the js code which colors the gradient uses before 0.4. I tried to understand it looking at simpleheat.js function (grad), since the minified version should come from here. One comment in this function says "create a 256x1 gradient that we'll use to turn a grayscale heatmap into a colored one". So should I assume that the gradient in 0 starts from black?
Additional context
Like user from issue #1579, I was trying to replicate the default gradient to build a colormap for the heatmap plot, and it was not obvious to figure out that the gradient color used could be defined in the leaflet.js file.
Possible solutions
Passing defaultGradient as object for folium.plugins.HeatMap, even if it will do nothing because the default is still defined in the leaflet.js code, it could be useful for future users.