10000 DOC: scales - built in options and custom usefulness · matplotlib/matplotlib@97390e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 97390e3

Browse files
committed
DOC: scales - built in options and custom usefulness
1 parent ba32c7e commit 97390e3

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

galleries/examples/scales/custom_scale.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@
66
============
77
88
Create a custom scale, by implementing the scaling use for latitude data in a
9-
Mercator Projection.
9+
Mercator Projection. A custom scale is useful when
1010
11-
Unless you are making special use of the `.Transform` class, you probably
12-
don't need to use this verbose method, and instead can use `~.scale.FuncScale`
13-
and the ``'function'`` option of `~.Axes.set_xscale` and `~.Axes.set_yscale`.
14-
See the last example in :doc:`/gallery/scales/scales`.
11+
* You are making special use of the `.Transform` class, such as the special
12+
handling of values beyond the threshold in ``MercatorLatitudeTransform``
13+
below.
14+
15+
* You want to override the default locators and formatters for the axis
16+
(``set_default_locators_and_formatters`` below).
17+
18+
* You want to limit the range of the the axis (``limit_range_for_scale`` below).
19+
20+
If you do not need any of the above, then you probably don't need to use this
21+
verbose method, and instead can use `~.scale.FuncScale` and the ``'function'``
22+
option of `~.Axes.set_xscale` and `~.Axes.set_yscale`. See the last example in
23+
:doc:`/gallery/scales/scales`.
1524
"""
1625

1726
import numpy as np

lib/matplotlib/axis.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -759,26 +759,22 @@ def _set_axes_scale(self, value, **kwargs):
759759
760760
Parameters
761761
----------
762-
value : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase`
763-
The axis scale type to apply.
762+
value : str or `.ScaleBase`
763+
The axis scale type to apply. Supported string values are "linear", "log",
764+
"symlog", "logit", "function", "functionlog", "asinh", and the names of any
765+
custom scales registered using `matplotlib.scale.register_scale`.
764766
765767
**kwargs
766-
Different keyword arguments are accepted, depending on the scale.
767-
See the respective class keyword arguments:
768+
If *value* is a string, keywords are passed to the instantiation method of
769+
the respective class:
768770
769771
- `matplotlib.scale.LinearScale`
770772
- `matplotlib.scale.LogScale`
771773
- `matplotlib.scale.SymmetricalLogScale`
772774
- `matplotlib.scale.LogitScale`
773775
- `matplotlib.scale.FuncScale`
776+
- `matplotlib.scale.FuncScaleLog`
774777
- `matplotlib.scale.AsinhScale`
775-
776-
Notes
777-
-----
778-
By default, Matplotlib supports the above-mentioned scales.
779-
Additionally, custom scales may be registered using
780-
`matplotlib.scale.register_scale`. These scales can then also
781-
be used here.
782778
"""
783779
name = self._get_axis_name()
784780
old_default_lims = (self.get_major_locator()

0 commit comments

Comments
 (0)
0