Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix explore() with highlight_kwds containing custom style_function #3032

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions geopandas/explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,20 @@ def _style_default(x):
if highlight:
if "fillOpacity" not in highlight_kwds:
highlight_kwds["fillOpacity"] = 0.75

if "style_function" in highlight_kwds:
highlight_kwds_function = highlight_kwds["style_function"]
if not callable(highlight_kwds_function):
raise ValueError("'style_function' has to be a callable")
highlight_kwds.pop("style_function")
else:

def _no_style(x):
return {}

highlight_kwds_function = _no_style

def _style_highlight(x):
return {**highlight_kwds}
return {**highlight_kwds, **highlight_kwds_function(x)}

highlight_function = _style_highlight
else:
Expand Down