Skip to content

DOC: Scale axis parameter #30404

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 6 commits into from
Aug 11, 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
45 changes: 41 additions & 4 deletions lib/matplotlib/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
`~matplotlib.axis.Axis`\es at the same time.
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
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):
Expand Down Expand Up @@ -236,6 +239,12 @@ def __init__(self, axis, functions):
----------
axis : `~matplotlib.axis.Axis`
The axis for the scale.

.. note::
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)
two-tuple of the forward and inverse functions for the scale.
The forward function must be monotonic.
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -706,7 +737,13 @@ 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.

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
Expand Down
Loading