From 9b990102ece96844cf20f0b474ef95ee97b62a70 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sat, 11 Jan 2025 19:13:08 +0000 Subject: [PATCH] Backport PR #29457: DOC: Use float instead for scalar for type descriptions in docstrings --- lib/matplotlib/artist.py | 4 ++-- lib/matplotlib/axes/_axes.py | 12 ++++++------ lib/matplotlib/backend_bases.py | 4 ++-- lib/matplotlib/backends/backend_mixed.py | 4 ++-- lib/matplotlib/colors.py | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index 17724c8b027a..c87c789048c4 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -1016,7 +1016,7 @@ def set_alpha(self, alpha): Parameters ---------- - alpha : scalar or None + alpha : float or None *alpha* must be within the 0-1 range, inclusive. """ if alpha is not None and not isinstance(alpha, Real): @@ -1035,7 +1035,7 @@ def _set_alpha_for_array(self, alpha): Parameters ---------- - alpha : array-like or scalar or None + alpha : array-like or float or None All values must be within the 0-1 range, inclusive. Masked values and nans are not supported. """ diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index bf4e0b031b59..ed0ec5412955 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1618,7 +1618,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs): Parameters ---------- - x, y : array-like or scalar + x, y : array-like or float The horizontal / vertical coordinates of the data points. *x* values are optional and default to ``range(len(y))``. @@ -4250,13 +4250,13 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=None, A list of dictionaries containing stats for each boxplot. Required keys are: - - ``med``: Median (scalar). - - ``q1``, ``q3``: First & third quartiles (scalars). - - ``whislo``, ``whishi``: Lower & upper whisker positions (scalars). + - ``med``: Median (float). + - ``q1``, ``q3``: First & third quartiles (float). + - ``whislo``, ``whishi``: Lower & upper whisker positions (float). Optional keys are: - - ``mean``: Mean (scalar). Needed if ``showmeans=True``. + - ``mean``: Mean (float). Needed if ``showmeans=True``. - ``fliers``: Data beyond the whiskers (array-like). Needed if ``showfliers=True``. - ``cilo``, ``cihi``: Lower & upper confidence intervals @@ -6891,7 +6891,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None, ``True``, then the histogram is normalized such that the first bin equals 1. - bottom : array-like, scalar, or None, default: None + bottom : array-like or float, default: 0 Location of the bottom of each bin, i.e. bins are drawn from ``bottom`` to ``bottom + hist(x, bins)`` If a scalar, the bottom of each bin is shifted by the same amount. If an array, each bin diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index d39fc0a1288b..0843796bad5a 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -428,11 +428,11 @@ def draw_image(self, gc, x, y, im, transform=None): gc : `.GraphicsContextBase` A graphics context with clipping information. - x : scalar + x : float The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas. - y : scalar + y : float The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas. diff --git a/lib/matplotlib/backends/backend_mixed.py b/lib/matplotlib/backends/backend_mixed.py index 6571d1928c0d..971d73cdb448 100644 --- a/lib/matplotlib/backends/backend_mixed.py +++ b/lib/matplotlib/backends/backend_mixed.py @@ -21,9 +21,9 @@ def __init__(self, figure, width, height, dpi, vector_renderer, ---------- figure : `~matplotlib.figure.Figure` The figure instance. - width : scalar + width : float The width of the canvas in logical units - height : scalar + height : float The height of the canvas in logical units dpi : float The dpi of the canvas diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 5f909d07c190..e881af04508c 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -717,7 +717,7 @@ def __call__(self, X, alpha=None, bytes=False): r""" Parameters ---------- - X : float or int, `~numpy.ndarray` or scalar + X : float or int or array-like The data value(s) to convert to RGBA. For floats, *X* should be in the interval ``[0.0, 1.0]`` to return the RGBA values ``X*100`` percent along the Colormap line. @@ -745,7 +745,7 @@ def _get_rgba_and_mask(self, X, alpha=None, bytes=False): r""" Parameters ---------- - X : float or int, `~numpy.ndarray` or scalar + X : float or int or array-like The data value(s) to convert to RGBA. For floats, *X* should be in the interval ``[0.0, 1.0]`` to return the RGBA values ``X*100`` percent along the Colormap line. @@ -1566,7 +1566,7 @@ def __call__(self, X, alpha=None, bytes=False): r""" Parameters ---------- - X : tuple (X0, X1), X0 and X1: float or int `~numpy.ndarray` or scalar + X : tuple (X0, X1), X0 and X1: float or int or array-like The data value(s) to convert to RGBA. - For floats, *X* should be in the interval ``[0.0, 1.0]`` to