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

Fix bug where edge colors are randomly shuffled in mpl_draw (backport #1312) #1317

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions releasenotes/notes/correct-edge-colors-e082e1761e1c060b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
- |
Fixed a bug introduced in version 0.15 where the edge colors specified as
a list in calls to :func:`~rustworkx.visualization.mpl_draw` were not
having their order respected. Instead, the order of the colors was
being shuffled. This has been restored and now the behavior should
match that of 0.14.
7 changes: 7 additions & 0 deletions rustworkx/visualization/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,14 @@ def draw_edges(
edge_color = "k"

# set edge positions
<<<<<<< HEAD
edge_pos = np.asarray([(pos[e[0]], pos[e[1]]) for e in edge_list])
=======
edge_pos_keys = dict()
for e in edge_list:
edge_pos_keys[(tuple(pos[e[0]]), tuple(pos[e[1]]))] = None
edge_pos = edge_pos_keys.keys()
>>>>>>> 44d9fb0 (Fix bug where edge colors are randomly shuffled in `mpl_draw` (#1312))

# Check if edge_color is an array of floats and map to edge_cmap.
# This is the only case handled differently from matplotlib
Expand Down
Loading