Skip to content

Commit 51ebab1

Browse files
committed
Add node id to plot
1 parent 2c7f1b0 commit 51ebab1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/track_linearization/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ def plot_track_graph(track_graph, ax=None, draw_edge_labels=False, **kwds):
6060
ax = plt.gca()
6161
node_position = nx.get_node_attributes(track_graph, "pos")
6262
nx.draw_networkx_nodes(track_graph, node_position, ax=ax, **kwds)
63+
for node_id, pos in node_position.items():
64+
plt.text(
65+
pos[0],
66+
pos[1],
67+
str(node_id),
68+
fontsize=8,
69+
ha="center",
70+
va="center",
71+
)
6372
for node_id1, node_id2 in track_graph.edges:
6473
pos = np.stack((node_position[node_id1], node_position[node_id2]))
6574
ax.plot(pos[:, 0], pos[:, 1], color="black", zorder=-1)

0 commit comments

Comments
 (0)