Skip to content

[Bug]: Argument types for handles and labels are too strict for method Axes.legend #27507

@Daverball

Description

@Daverball

Bug summary

Axes.legend is annotated too strictly and incorrectly necessitates Sequence for handles and labels, even though any Iterable works. This also contradicts the docstring on the method.

Code for reproduction

handles, labels = ax.get_legend_handles_labels()
ax.legend(iter(handles), iter(labels))

Actual outcome

No overload variant of "legend" of "Axes" matches argument types "Iterator[Artist]", "Iterator[Any]" [call-overload]

Expected outcome

Passes without type error

Additional information

No response

Operating system

No response

Matplotlib Version

3.8.2

Matplotlib Backend

No response

Python version

3.10

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy