Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
fixes:
- |
Fixed an issue where using function ``draw_edges()`` in
~/rustworkx/visualization/matplotlib.py will always attempt to use
connectionstyle arc3 even if a different connectionstyle argument is
input by the user. Now, `draw_edges()` can accept different connectionstyle arguments.
If connectionstyle arc3 is used, the previous `draw_edges()` behavior is still used.
Refer to `#1497 <https://github.com/Qiskit/rustworkx/issues/1497>`__ for more details.
2 changes: 1 addition & 1 deletion rustworkx/visualization/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ def to_marker_edge(marker_size, marker):
mutation_scale=mutation_scale,
color=arrow_color,
linewidth=line_width,
connectionstyle=f"{connectionstyle}, rad = {rad}",
connectionstyle=f"{connectionstyle}, rad = {rad}" if connectionstyle=="arc3" else f"{connectionstyle}",
linestyle=style,
zorder=1,
) # arrows go behind nodes
Expand Down
12 changes: 12 additions & 0 deletions tests/visualization/test_mpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,15 @@ def test_hexagonal_lattice_directed(self):
plt.close("all")
mpl_draw(graph, pos=[graph.get_node_data(n) for n in range(len(graph))])
_save_images(plt.gcf(), "test_hexagonal_lattice_directed.png")

def test_connectionstyles(self):
G = rustworkx.generators.directed_path_graph(25)
mpl_draw(G, connectionstyle='bar')
_save_images(plt.gcf(), "test_connectionstyle_bar.png")
plt.clf()
mpl_draw(G, connectionstyle='angle, angleA=30, angleB=150, rad=1.3')
_save_images(plt.gcf(), "test_connectionstyle_angle.png")
plt.clf()
mpl_draw(G, connectionstyle='angle3, angleA=20, angleB=60')
_save_images(plt.gcf(), "test_connectionstyle_angle3.png")
plt.clf()
Loading