Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 428cf41

Browse filesBrowse files
oscargusmeeseeksmachine
authored andcommitted
Backport PR #27535: Update ax.legend input types
1 parent 72a1224 commit 428cf41
Copy full SHA for 428cf41

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def legend(self, *args, **kwargs):
280280
281281
Parameters
282282
----------
283-
handles : sequence of (`.Artist` or tuple of `.Artist`), optional
283+
handles : list of (`.Artist` or tuple of `.Artist`), optional
284284
A list of Artists (lines, patches) to be added to the legend.
285285
Use this together with *labels*, if you need full control on what
286286
is shown in the legend and the automatic mechanism described above

‎lib/matplotlib/axes/_axes.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.pyi
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import matplotlib.streamplot as mstream
3131

3232
import datetime
3333
import PIL.Image
34-
from collections.abc import Callable, Sequence
34+
from collections.abc import Callable, Iterable, Sequence
3535
from typing import Any, Literal, overload
3636
import numpy as np
3737
from numpy.typing import ArrayLike
@@ -57,11 +57,11 @@ class Axes(_AxesBase):
5757
@overload
5858
def legend(self) -> Legend: ...
5959
@overload
60-
def legend(self, handles: Sequence[Artist | tuple[Artist, ...]], labels: Sequence[str], **kwargs) -> Legend: ...
60+
def legend(self, handles: Iterable[Artist | tuple[Artist, ...]], labels: Iterable[str], **kwargs) -> Legend: ...
6161
@overload
62-
def legend(self, *, handles: Sequence[Artist | tuple[Artist, ...]], **kwargs) -> Legend: ...
62+
def legend(self, *, handles: Iterable[Artist | tuple[Artist, ...]], **kwargs) -> Legend: ...
6363
@overload
64-
def legend(self, labels: Sequence[str], **kwargs) -> Legend: ...
64+
def legend(self, labels: Iterable[str], **kwargs) -> Legend: ...
6565
@overload
6666
def legend(self, **kwargs) -> Legend: ...
6767

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.