Skip to content

python mpl_draw always sets rad in connectionstyle #1497

@codewing

Description

@codewing

Information

  • rustworkx version: 0.17.1
  • Python version: 3.15.5
  • Rust version: --
  • Operating system: Linux

What is the current behavior?

calling mpl_draw with a connection style of bar (goal is to have straight lines) breaks

mpl_draw(
            self.graph,
            node_color=node_colors,
            pos=node_positions,
            node_size=node_size,
            arrow_size=arrow_size,
            connectionstyle='bar'
        )

with error TypeError: ConnectionStyle.Bar.__init__() got an unexpected keyword argument 'rad'

What is the expected behavior?

No additional args are added for my custom connection styles that break execution

Steps to reproduce the problem

import matplotlib.pyplot as plt

import rustworkx as rx
from rustworkx.visualization import mpl_draw

G = rx.generators.directed_path_graph(25)
mpl_draw(G, connectionstyle='bar')

Bonus

I've also tried it with to get straight lines
connectionstyle='arc3,rad=0.'
but this most likely also doesn't work since the rad is overwritten by the additional arg that is automatically set here: https://github.com/Qiskit/rustworkx/blob/main/rustworkx/visualization/matplotlib.py#L734

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions