Skip to content

Commit e36bffb

Browse files
Add explicit getter / setter overloads for pyplot.{xlim,ylim} (#30199)
* Add xlim / ylim autogeneration - Create get_signature method - Create AXES_GETTER_SETTER_TEMPLATE - Create call_param method on generate_function (cherry picked from commit e57b321) * Format with ruff (cherry picked from commit 64e7921) * Remove old xlim and ylim (cherry picked from commit 66ee071) * Format with ruff * Revert superfluous changes * Revert boilerplate.py and manually copy xlim and ylim overloads on pyplot.py * Remove incorrect comment about autogenerated method --------- Co-authored-by: Corenthin ZOZOR <corenthin.zozor@gmail.com>
1 parent 4b03f0c commit e36bffb

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

lib/matplotlib/pyplot.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,24 @@ def box(on: bool | None = None) -> None:
21152115
## Axis ##
21162116

21172117

2118+
@overload
2119+
def xlim() -> tuple[float, float]:
2120+
...
2121+
2122+
2123+
@overload
2124+
def xlim(
2125+
left: float | tuple[float, float] | None = None,
2126+
right: float | None = None,
2127+
*,
2128+
emit: bool = True,
2129+
auto: bool | None = False,
2130+
xmin: float | None = None,
2131+
xmax: float | None = None,
2132+
) -> tuple[float, float]:
2133+
...
2134+
2135+
21182136
def xlim(*args, **kwargs) -> tuple[float, float]:
21192137
"""
21202138
Get or set the x limits of the current Axes.
@@ -2152,6 +2170,24 @@ def xlim(*args, **kwargs) -> tuple[float, float]:
21522170
return ret
21532171

21542172

2173+
@overload
2174+
def ylim() -> tuple[float, float]:
2175+
...
2176+
2177+
2178+
@overload
2179+
def ylim(
2180+
bottom: float | tuple[float, float] | None = None,
2181+
top: float | None = None,
2182+
*,
2183+
emit: bool = True,
2184+
auto: bool | None = False,
2185+
ymin: float | None = None,
2186+
ymax: float | None = None,
2187+
) -> tuple[float, float]:
2188+
...
2189+
2190+
21552191
def ylim(*args, **kwargs) -> tuple[float, float]:
21562192
"""
21572193
Get or set the y-limits of the current Axes.

0 commit comments

Comments
 (0)