Skip to content

No error message in matplotlib.axes.Axes.legend() if there are more labels than handles #24050

@haferburg

Description

@haferburg

I had a bug in my code where I called plot() six times, stored the handles in a list, then called legend() with six handles, but seven labels for the legend.

It would have been very helpful if matplotlib raised an exception in this case.

matplotlib.__version__ is 3.6.0, Python 3.9.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: argument checkingDifficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!topic: legend

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions