Skip to content

Commit

Permalink
Backport PR matplotlib#29353: DOC: Improve module docs of matplotlib.…
Browse files Browse the repository at this point in the history
…scale
  • Loading branch information
timhoffm authored and meeseeksmachine committed Dec 21, 2024
1 parent ab90482 commit 8cb736d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions doc/api/scale_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource
33 changes: 25 additions & 8 deletions lib/matplotlib/scale.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
"""
Scales define the distribution of data values on an axis, e.g. a log scaling.
They are defined as subclasses of `ScaleBase`.
See also `.axes.Axes.set_xscale` and the scales examples in the documentation.
The mapping is implemented through `.Transform` subclasses.
See :doc:`/gallery/scales/custom_scale` for a full example of defining a custom
scale.
The following scales are builtin:
Matplotlib also supports non-separable transformations that operate on both
`~.axis.Axis` at the same time. They are known as projections, and defined in
`matplotlib.projections`.
"""
============= ===================== ================================ =================================
Name Class Transform Inverted transform
============= ===================== ================================ =================================
"asinh" `AsinhScale` `AsinhTransform` `InvertedAsinhTransform`
"function" `FuncScale` `FuncTransform` `FuncTransform`
"functionlog" `FuncScaleLog` `FuncTransform` + `LogTransform` `InvertedLogTransform` + `FuncTransform`
"linear" `LinearScale` `.IdentityTransform` `.IdentityTransform`
"log" `LogScale` `LogTransform` `InvertedLogTransform`
"logit" `LogitScale` `LogitTransform` `LogisticTransform`
"symlog" `SymmetricalLogScale` `SymmetricalLogTransform` `InvertedSymmetricalLogTransform`
============= ===================== ================================ =================================
A user will often only use the scale name, e.g. when setting the scale through
`~.Axes.set_xscale`: ``ax.set_xscale("log")``.
See also the :ref:`scales examples <sphx_glr_gallery_scales>` in the documentation.
Custom scaling can be achieved through `FuncScale`, or by creating your own
`ScaleBase` subclass and corresponding transforms (see :doc:`/gallery/scales/custom_scale`).
Third parties can register their scales by name through `register_scale`.
""" # noqa: E501

import inspect
import textwrap
Expand Down Expand Up @@ -412,6 +427,8 @@ class SymmetricalLogScale(ScaleBase):
*linthresh* allows the user to specify the size of this range
(-*linthresh*, *linthresh*).
See :doc:`/gallery/scales/symlog_demo` for a detailed description.
Parameters
----------
base : float, default: 10
Expand Down

0 comments on commit 8cb736d

Please sign in to comment.