Skip to content

Add explicit getter / setter overloads for pyplot.{xlim,ylim} #30199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,24 @@
## Axis ##


@overload
def xlim() -> tuple[float, float]:
...

Check warning on line 2101 in lib/matplotlib/pyplot.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/pyplot.py#L2101

Added line #L2101 was not covered by tests


@overload
def xlim(
left: float | tuple[float, float] | None = None,
right: float | None = None,
*,
emit: bool = True,
auto: bool | None = False,
xmin: float | None = None,
xmax: float | None = None,
) -> tuple[float, float]:
...

Check warning on line 2114 in lib/matplotlib/pyplot.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/pyplot.py#L2114

Added line #L2114 was not covered by tests


def xlim(*args, **kwargs) -> tuple[float, float]:
"""
Get or set the x limits of the current Axes.
Expand Down Expand Up @@ -2133,6 +2151,24 @@
return ret


@overload
def ylim() -> tuple[float, float]:
...

Check warning on line 2156 in lib/matplotlib/pyplot.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/pyplot.py#L2156

Added line #L2156 was not covered by tests


@overload
def ylim(
bottom: float | tuple[float, float] | None = None,
top: float | None = None,
*,
emit: bool = True,
auto: bool | None = False,
ymin: float | None = None,
ymax: float | None = None,
) -> tuple[float, float]:
...

Check warning on line 2169 in lib/matplotlib/pyplot.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/pyplot.py#L2169

Added line #L2169 was not covered by tests


def ylim(*args, **kwargs) -> tuple[float, float]:
"""
Get or set the y-limits of the current Axes.
Expand Down