Skip to content

TypeError in Arcs() due to Argument Mismatch with matplotlib.patches.Arc #97

@skelviper

Description

@skelviper

Hello Developer,

I am a huge fan of CoolBox and it has significantly improved my productivity. I've encountered an issue with the Arcs() function when it calls matplotlib. The error message I receive is:

TypeError: Arc.__init__() takes 4 positional arguments but 7 were given

This seems to be due to the current function definition in matplotlib, which is structured as follows:

class matplotlib.patches.Arc(xy, width, height, *, angle=0.0, theta1=0.0, theta2=360.0, **kwargs)

Here, the fourth positional argument is an asterisk *, indicating the end of positional arguments and the start of keyword-only arguments.

In the coolbox implementation located at coolbox/core/track/arcs/plot.py on line 106, the call to the Arc constructor does not comply with the new matplotlib interface. I suggest modifying this line to use keyword arguments as follows:

arc = Arc(
    xy=(center, 0), 
    width=diameter,
    height=height, 
    angle=0, 
    theta1=0, 
    theta2=180,
    color=color,
    alpha=alpha,
    lw=line_width,
    linestyle=properties['line_style']
)

This change should resolve the TypeError by matching the expected signature of the Arc constructor in the latest version of matplotlib.

Thank you for your attention to this issue.

Best regards,
Zhiyuan Liu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions