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

pass kwargs to explore #627

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion libpysal/graph/_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def _explore_graph(
node_kws=None,
focal_kws=None,
m=None,
**kwargs,
):
"""Plot graph as an interactive Folium Map

Expand Down Expand Up @@ -177,6 +178,10 @@ def _explore_graph(
passing a subset of nodes with the `focal` argument
m : Folilum.Map, optional
folium map objecto to plot on top of, by default None
**kwargs : dict, optional
additional keyword arguments are passed directly to geopandas.explore, when
``m=None`` by default None


Returns
-------
Expand Down Expand Up @@ -230,7 +235,11 @@ def _explore_graph(
["focal", "neighbor", "weight", "geometry"]
]

m = edges.explore(m=m, **edge_kws) if m is not None else edges.explore(**edge_kws)
m = (
edges.explore(m=m, **edge_kws)
if m is not None
else edges.explore(**edge_kws, **kwargs)
)

if nodes is True:
if focal is not None:
Expand Down
5 changes: 5 additions & 0 deletions libpysal/graph/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@ def explore(
node_kws=None,
focal_kws=None,
m=None,
**kwargs,
):
"""Plot graph as an interactive Folium Map

Expand All @@ -1314,6 +1315,9 @@ def explore(
passing a subset of nodes with the `focal` argument
m : Folilum.Map, optional
folium map objecto to plot on top of, by default None
**kwargs : dict, optional
additional keyword arguments are passed directly to geopandas.explore, when
``m=None`` by default None

Returns
-------
Expand All @@ -1330,6 +1334,7 @@ def explore(
node_kws=node_kws,
focal_kws=focal_kws,
m=m,
**kwargs,
)


Expand Down
6 changes: 6 additions & 0 deletions libpysal/graph/tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,9 @@ def test_m(self):
assert s.count("LineString") == 6
# geoms
assert s.count("Polygon") == 5

def test_explore_kwargs(self):
m = self.G_str.explore(self.nybb_str, tiles="OpenStreetMap HOT")
s = fetch_map_string(m)

assert "tile.openstreetmap.fr/hot" in s