From 4900eafa28f95e58cbf3b1354e73b088651d0b9d Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:24:51 +0200 Subject: [PATCH 1/6] DOC: Scale axis parameter --- lib/matplotlib/scale.py | 44 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index 4517b8946b03..47e3234cbd0e 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -75,9 +75,12 @@ def __init__(self, axis): The following note is for scale implementers. For back-compatibility reasons, scales take an `~matplotlib.axis.Axis` - object as first argument. However, this argument should not - be used: a single scale object should be usable by multiple + object as first argument. We plan to remove it in the future, because + we want to make a scale object usable by multiple `~matplotlib.axis.Axis`\es at the same time. + + The current recommendation for `.ScaleBase` subclasses is to have the + *axis* parameter for API compatibility, but not make use of it. """ def get_transform(self): @@ -236,6 +239,12 @@ def __init__(self, axis, functions): ---------- axis : `~matplotlib.axis.Axis` The axis for the scale. + + .. note:: + This parameter is unused and about to be removed in the future. + It can already now be left out because of special preprocessing, + so that ``FuncScale(functions)`` is valid. + functions : (callable, callable) two-tuple of the forward and inverse functions for the scale. The forward function must be monotonic. @@ -336,6 +345,12 @@ def __init__(self, axis=None, *, base=10, subs=None, nonpositive="clip"): ---------- axis : `~matplotlib.axis.Axis` The axis for the scale. + + .. note:: + This parameter is unused and about to be removed in the future. + It can already now be left out because of special preprocessing, + so that ``LogScale(base=2)`` is valid. + base : float, default: 10 The base of the logarithm. nonpositive : {'clip', 'mask'}, default: 'clip' @@ -485,6 +500,14 @@ class SymmetricalLogScale(ScaleBase): Parameters ---------- + axis : `~matplotlib.axis.Axis` + The axis for the scale. + + .. note:: + This parameter is unused and about to be removed in the future. + It can already now be left out because of special preprocessing, + so that ``SymmetricalLocSacle(base=2)`` is valid. + base : float, default: 10 The base of the logarithm. @@ -606,6 +629,14 @@ def __init__(self, axis=None, *, linear_width=1.0, """ Parameters ---------- + axis : `~matplotlib.axis.Axis` + The axis for the scale. + + .. note:: + This parameter is unused and about to be removed in the future. + It can already now be left out because of special preprocessing, + so that ``AsinhScale()`` is valid. + linear_width : float, default: 1 The scale parameter (elsewhere referred to as :math:`a_0`) defining the extent of the quasi-linear region, @@ -706,7 +737,14 @@ def __init__(self, axis=None, nonpositive='mask', *, Parameters ---------- axis : `~matplotlib.axis.Axis` - Currently unused. + The axis for the scale. + + .. note:: + This parameter is unused and about to be removed in the future. + It can already now be left out because of special preprocessing, + so that ``LogitScale()`` is valid. + + Currently unused. nonpositive : {'mask', 'clip'} Determines the behavior for values beyond the open interval ]0, 1[. They can either be masked as invalid, or clipped to a number very From b0f0c2d6c5dbadc54fb3ef2d398992c87f3d7ac6 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Fri, 8 Aug 2025 06:48:20 +0200 Subject: [PATCH 2/6] Update lib/matplotlib/scale.py Co-authored-by: Elliott Sales de Andrade --- lib/matplotlib/scale.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index 47e3234cbd0e..e778a7fa3358 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -744,7 +744,6 @@ def __init__(self, axis=None, nonpositive='mask', *, It can already now be left out because of special preprocessing, so that ``LogitScale()`` is valid. - Currently unused. nonpositive : {'mask', 'clip'} Determines the behavior for values beyond the open interval ]0, 1[. They can either be masked as invalid, or clipped to a number very From 10eca973b568d62d5774f399e15091c6667a4f9d Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 9 Aug 2025 14:13:57 +0200 Subject: [PATCH 3/6] Update lib/matplotlib/scale.py Co-authored-by: hannah --- lib/matplotlib/scale.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index e778a7fa3358..b4da0041ff06 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -75,12 +75,13 @@ def __init__(self, axis): The following note is for scale implementers. For back-compatibility reasons, scales take an `~matplotlib.axis.Axis` - object as first argument. We plan to remove it in the future, because - we want to make a scale object usable by multiple - `~matplotlib.axis.Axis`\es at the same time. + object as first argument. The current recommendation for `.ScaleBase` subclasses is to have the - *axis* parameter for API compatibility, but not make use of it. + *axis* parameter for API compatibility, but not make use of it. This is + because we plan to remove this argument to make a scale object usable + by multiple `~matplotlib.axis.Axis`\es at the same time. + """ def get_transform(self): From 2fe9ef94b408543ff3485823ae0d24449a57adb5 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 11 Aug 2025 07:38:28 +0200 Subject: [PATCH 4/6] Apply suggestions from code review Co-authored-by: hannah --- lib/matplotlib/scale.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index b4da0041ff06..9c603cd2b9c1 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -75,7 +75,7 @@ def __init__(self, axis): The following note is for scale implementers. For back-compatibility reasons, scales take an `~matplotlib.axis.Axis` - object as first argument. + object as the first argument. The current recommendation for `.ScaleBase` subclasses is to have the *axis* parameter for API compatibility, but not make use of it. This is @@ -242,8 +242,8 @@ def __init__(self, axis, functions): The axis for the scale. .. note:: - This parameter is unused and about to be removed in the future. - It can already now be left out because of special preprocessing, + This parameter is unused and will be removed in an imminent release. + It can already be left out because of special preprocessing, so that ``FuncScale(functions)`` is valid. functions : (callable, callable) From 94747d6675113c97c2c53ebac255267b44407549 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 11 Aug 2025 07:38:53 +0200 Subject: [PATCH 5/6] Update lib/matplotlib/scale.py --- lib/matplotlib/scale.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index 9c603cd2b9c1..c9fa47e6d2a3 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -81,7 +81,6 @@ def __init__(self, axis): *axis* parameter for API compatibility, but not make use of it. This is because we plan to remove this argument to make a scale object usable by multiple `~matplotlib.axis.Axis`\es at the same time. - """ def get_transform(self): From af62ad2f860e0cf08ade11d9058b2ccd5d4649c4 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 11 Aug 2025 10:36:08 +0200 Subject: [PATCH 6/6] Update lib/matplotlib/scale.py --- lib/matplotlib/scale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index c9fa47e6d2a3..1553e057670f 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -75,7 +75,7 @@ def __init__(self, axis): The following note is for scale implementers. For back-compatibility reasons, scales take an `~matplotlib.axis.Axis` - object as the first argument. + object as the first argument. The current recommendation for `.ScaleBase` subclasses is to have the *axis* parameter for API compatibility, but not make use of it. This is