88import xyzservices
99from datetime import date , timedelta
1010from math import isnan
11- from branca .colormap import linear , ColorMap
11+ from branca .colormap import linear , LinearColormap , ColorMap
1212from IPython .display import display
1313import warnings
1414
@@ -799,8 +799,16 @@ class Heatmap(RasterLayer):
799799 Radius of the data points.
800800 blur: float, default 15.
801801 Blurring intensity.
802- gradient: dict, default {0.4: 'blue', 0.6: 'cyan', 0.7: 'lime', 0.8: 'yellow', 1.0: 'red'}
802+ values : list, default [0.4, 0.6, 0.7, 0.8, 1.0]
803+ list of values to define the gradient
804+ colors : list, default ['blue', 'cyan', 'lime', 'yellow', 'red']
805+ list of colors to define the gradient
806+ dict: dict, default built from values (keys) and colors lists (values)
807+ dictionnary mapping value to colors.
808+ gradient : Dict, default built from dict
803809 Colors used for the color-mapping from low to high heatmap intensity.
810+ colormap: branca.colormap.LinearColorMap instance
811+ The colormap used for displaying the HeatMap data, defined with the same min and max values and colors than the gradient.
804812 """
805813
806814 _view_name = Unicode ('LeafletHeatmapView' ).tag (sync = True )
@@ -815,6 +823,15 @@ class Heatmap(RasterLayer):
815823 radius = Float (25.0 ).tag (sync = True , o = True )
816824 blur = Float (15.0 ).tag (sync = True , o = True )
817825 gradient = Dict ({0.4 : 'blue' , 0.6 : 'cyan' , 0.7 : 'lime' , 0.8 : 'yellow' , 1.0 : 'red' }).tag (sync = True , o = True )
826+ colors = ['blue' , 'cyan' , 'lime' , 'yellow' , 'red' ]
827+ values = [0.4 , 0.6 , 0.7 , 0.8 , 1.0 ]
828+ dict = {}
829+ for i in range (len (values )):
830+ dict [values [i ]] = colors [i ]
831+ vmin = values [0 ]
832+ vmax = values [len (values )- 1 ]
833+ gradient = Dict (dict ).tag (sync = True , o = True )
834+ colormap = LinearColormap (colors , vmin = vmin , vmax = vmax )
818835
819836
820837class VectorTileLayer (Layer ):
0 commit comments