@@ -508,7 +508,8 @@ def choropleth(self, geo_path=None, geo_str=None, data_out='data.json',
508508 data = None , columns = None , key_on = None , threshold_scale = None ,
509509 fill_color = 'blue' , fill_opacity = 0.6 , line_color = 'black' ,
510510 line_weight = 1 , line_opacity = 1 , legend_name = "" ,
511- topojson = None , reset = False , smooth_factor = None ):
511+ topojson = None , reset = False , smooth_factor = None ,
512+ highlight = None ):
512513 """
513514 Apply a GeoJSON overlay to the map.
514515
@@ -580,6 +581,8 @@ def choropleth(self, geo_path=None, geo_str=None, data_out='data.json',
580581 How much to simplify the polyline on each zoom level. More means
581582 better performance and smoother look, and less means more accurate
582583 representation. Leaflet defaults to 1.0.
584+ highlight: boolean, default False
585+ Enable highlight functionality when hovering over a GeoJSON area.
583586
584587 Returns
585588 -------
@@ -596,6 +599,12 @@ def choropleth(self, geo_path=None, geo_str=None, data_out='data.json',
596599 ... threshold_scale=[0, 20, 30, 40, 50, 60])
597600 >>> m.choropleth(geo_path='countries.json',
598601 ... topojson='objects.countries')
602+ >>> m.choropleth(geo_path='geo.json', data=df,
603+ ... columns=['Data 1', 'Data 2'],
604+ ... key_on='feature.properties.myvalue',
605+ ... fill_color='PuBu',
606+ ... threshold_scale=[0, 20, 30, 40, 50, 60],
607+ ... highlight=True)
599608
600609 """
601610 if threshold_scale and len (threshold_scale ) > 6 :
@@ -677,6 +686,7 @@ def style_function(x):
677686 "fillColor" : color_scale_fun (x )
678687 }
679688
689+
680690 def highlight_function (x ):
681691 return {
682692 "weight" : line_weight + 2 ,
@@ -694,7 +704,7 @@ def highlight_function(x):
694704 geo_data ,
695705 style_function = style_function ,
696706 smooth_factor = smooth_factor ,
697- highlight_function = highlight_function )
707+ highlight_function = highlight_function if highlight else None )
698708
699709 self .add_child (geo_json )
700710
0 commit comments