Skip to content

Commit 5731bbd

Browse files
authored
Choropleth default fill color: blue or Blues (#1288)
* Choropleth default fill color: blue or Blues * Update GeoJSON_and_choropleth.ipynb
1 parent 27b53ba commit 5731bbd

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

examples/GeoJSON_and_choropleth.ipynb

Lines changed: 35 additions & 37 deletions
Large diffs are not rendered by default.

folium/features.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,9 +1064,9 @@ class Choropleth(FeatureGroup):
10641064
If `bins` is a sequence, it directly defines the bin edges.
10651065
For more information on this parameter, have a look at
10661066
numpy.histogram function.
1067-
fill_color: string, default 'blue'
1068-
Area fill color. Can pass a hex code, color name, or if you are
1069-
binding data, one of the following color brewer palettes:
1067+
fill_color: string, optional
1068+
Area fill color, defaults to blue. Can pass a hex code, color name,
1069+
or if you are binding data, one of the following color brewer palettes:
10701070
'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu',
10711071
'YlGn', 'YlGnBu', 'YlOrBr', and 'YlOrRd'.
10721072
nan_fill_color: string, default 'black'
@@ -1126,7 +1126,7 @@ class Choropleth(FeatureGroup):
11261126
"""
11271127

11281128
def __init__(self, geo_data, data=None, columns=None, key_on=None, # noqa
1129-
bins=6, fill_color='blue', nan_fill_color='black',
1129+
bins=6, fill_color=None, nan_fill_color='black',
11301130
fill_opacity=0.6, nan_fill_opacity=None, line_color='black',
11311131
line_weight=1, line_opacity=1, name=None, legend_name='',
11321132
overlay=True, control=True, show=True,
@@ -1136,6 +1136,8 @@ def __init__(self, geo_data, data=None, columns=None, key_on=None, # noqa
11361136
control=control, show=show)
11371137
self._name = 'Choropleth'
11381138

1139+
fill_color = fill_color or ('blue' if data is None else 'Blues')
1140+
11391141
if data is not None and not color_brewer(fill_color):
11401142
raise ValueError('Please pass a valid color brewer code to '
11411143
'fill_local. See docstring for valid codes.')

0 commit comments

Comments
 (0)