Skip to content

Commit

Permalink
Try/except intermittently failing basemaps in geospatial examples (ne…
Browse files Browse the repository at this point in the history
…tworkx#7324)

* Temporarily make poinst geospatial example non-executable.

Revert this when contextily basemap issue is improved.

* Revert "Temporarily rm geospatial examples to fix CI. (networkx#7299)"

This reverts commit fce5d7d.

* Revert "Temporarily make poinst geospatial example non-executable."

This reverts commit 02927e3.

* Try/except add_basemap in geospatial examples.
  • Loading branch information
rossbar authored and cvanelteren committed Apr 22, 2024
1 parent db9bde8 commit ed79508
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@

# Now, we can plot with a nice basemap.
ax = cells.plot(facecolor="lightblue", alpha=0.50, edgecolor="cornsilk", linewidth=2)
add_basemap(ax)
try: # Try-except for issues with timeout/parsing failures in CI
add_basemap(ax)
except:
pass

ax.axis("off")
nx.draw(
delaunay_graph,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@
for i, facet in enumerate(ax):
facet.set_title(("Streets", "Graph")[i])
facet.axis("off")
add_basemap(facet)
try: # For issues with downloading/parsing in CI
add_basemap(facet)
except:
pass
nx.draw(
G_primal, {n: [n[0], n[1]] for n in list(G_primal.nodes)}, ax=ax[1], node_size=50
)
Expand All @@ -92,7 +95,10 @@
for i, facet in enumerate(ax):
facet.set_title(("Streets", "Graph")[i])
facet.axis("off")
add_basemap(facet)
try: # For issues with downloading/parsing in CI
add_basemap(facet)
except:
pass
nx.draw(G_dual, {n: [n[0], n[1]] for n in list(G_dual.nodes)}, ax=ax[1], node_size=50)
plt.show()

Expand Down
5 changes: 4 additions & 1 deletion examples/geospatial/plot_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
f, ax = plt.subplots(1, 2, figsize=(8, 4))
for i, facet in enumerate(ax):
cases.plot(marker=".", color="orangered", ax=facet)
add_basemap(facet)
try: # For issues with downloading/parsing basemaps in CI
add_basemap(facet)
except:
pass
facet.set_title(("KNN-3", "50-meter Distance Band")[i])
facet.axis("off")
nx.draw(knn_graph, positions, ax=ax[0], node_size=5, node_color="b")
Expand Down

0 comments on commit ed79508

Please sign in to comment.