Skip to content

Commit 6072541

Browse files
authored
Merge pull request #627 from martinfleis/explore_kwags
pass kwargs to explore
2 parents 4290c11 + 9c17c03 commit 6072541

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

libpysal/graph/_plotting.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def _explore_graph(
149149
node_kws=None,
150150
focal_kws=None,
151151
m=None,
152+
**kwargs,
152153
):
153154
"""Plot graph as an interactive Folium Map
154155
@@ -177,6 +178,10 @@ def _explore_graph(
177178
passing a subset of nodes with the `focal` argument
178179
m : Folilum.Map, optional
179180
folium map objecto to plot on top of, by default None
181+
**kwargs : dict, optional
182+
additional keyword arguments are passed directly to geopandas.explore, when
183+
``m=None`` by default None
184+
180185
181186
Returns
182187
-------
@@ -230,7 +235,11 @@ def _explore_graph(
230235
["focal", "neighbor", "weight", "geometry"]
231236
]
232237

233-
m = edges.explore(m=m, **edge_kws) if m is not None else edges.explore(**edge_kws)
238+
m = (
239+
edges.explore(m=m, **edge_kws)
240+
if m is not None
241+
else edges.explore(**edge_kws, **kwargs)
242+
)
234243

235244
if nodes is True:
236245
if focal is not None:

libpysal/graph/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,7 @@ def explore(
12881288
node_kws=None,
12891289
focal_kws=None,
12901290
m=None,
1291+
**kwargs,
12911292
):
12921293
"""Plot graph as an interactive Folium Map
12931294
@@ -1314,6 +1315,9 @@ def explore(
13141315
passing a subset of nodes with the `focal` argument
13151316
m : Folilum.Map, optional
13161317
folium map objecto to plot on top of, by default None
1318+
**kwargs : dict, optional
1319+
additional keyword arguments are passed directly to geopandas.explore, when
1320+
``m=None`` by default None
13171321
13181322
Returns
13191323
-------
@@ -1330,6 +1334,7 @@ def explore(
13301334
node_kws=node_kws,
13311335
focal_kws=focal_kws,
13321336
m=m,
1337+
**kwargs,
13331338
)
13341339

13351340

libpysal/graph/tests/test_plotting.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,9 @@ def test_m(self):
368368
assert s.count("LineString") == 6
369369
# geoms
370370
assert s.count("Polygon") == 5
371+
372+
def test_explore_kwargs(self):
373+
m = self.G_str.explore(self.nybb_str, tiles="OpenStreetMap HOT")
374+
s = fetch_map_string(m)
375+
376+
assert "tile.openstreetmap.fr/hot" in s

0 commit comments

Comments
 (0)