From 00b4df2178346e25b724a2e471800fd0444403b5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 3 Apr 2025 02:59:44 -0400 Subject: [PATCH] Backport PR #29545: DOC: correctly specify return type of `figaspect` --- lib/matplotlib/figure.py | 4 ++-- lib/matplotlib/figure.pyi | 4 +++- lib/matplotlib/pyplot.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 3d6f9a7f4c16..089141727189 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -3665,8 +3665,8 @@ def figaspect(arg): Returns ------- - width, height : float - The figure size in inches. + size : (2,) array + The width and height of the figure in inches. Notes ----- diff --git a/lib/matplotlib/figure.pyi b/lib/matplotlib/figure.pyi index 08bf1505532b..064503c91384 100644 --- a/lib/matplotlib/figure.pyi +++ b/lib/matplotlib/figure.pyi @@ -418,4 +418,6 @@ class Figure(FigureBase): rect: tuple[float, float, float, float] | None = ... ) -> None: ... -def figaspect(arg: float | ArrayLike) -> tuple[float, float]: ... +def figaspect( + arg: float | ArrayLike, +) -> np.ndarray[tuple[Literal[2]], np.dtype[np.float64]]: ... diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 9ef61f335c18..1f50a05a54f7 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -873,7 +873,7 @@ def figure( # autoincrement if None, else integer from 1-N num: int | str | Figure | SubFigure | None = None, # defaults to rc figure.figsize - figsize: tuple[float, float] | None = None, + figsize: ArrayLike | None = None, # defaults to rc figure.dpi dpi: float | None = None, *, 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