Skip to content
Snippets Groups Projects
Commit 5cf7b1a1 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Polish

parent 8a1f3a2f
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,11 @@ def is_node_type(G, n, label):
sys.exit(f"is_node_type: bad label: {label}")
def plot_nbunch(G, nbunch, color = '#1f78b4', label = None, ax = None):
"""This function plots all nodes in nbunch and all edges with source
or target in nbunch.
"""
if ax is None: ax = plt.gca()
pos = G.nodes.data("coordinates")
nbunch_plot = nbunch.copy()
......@@ -59,7 +64,7 @@ def plot_nbunch(G, nbunch, color = '#1f78b4', label = None, ax = None):
xy = np.asarray([pos[n] for n in nbunch_plot])
src_crs = ccrs.PlateCarree()
ax.scatter(xy[:, 0], xy[:, 1], s = 10, c = color, marker='o',
ax.scatter(xy[:, 0], xy[:, 1], s = 10, c = color, marker = 'o',
transform = src_crs)
for e in G.edges(nbunch_plot):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment