| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,13 +5,25 @@ | |||
| 5 | 5 | Custom scale | |
| 6 | 6 | ============ | |
| 7 | 7 | ||
| 8 | - Create a custom scale, by implementing the scaling use for latitude data in a | ||
| 9 | - Mercator Projection. | ||
| 8 | + Custom scales can be created in two ways | ||
| 9 | + | ||
| 10 | + #. For simple cases, use `~.scale.FuncScale` and the ``'function'`` option of | ||
| 11 | + `~.Axes.set_xscale` and `~.Axes.set_yscale`. See the last example in | ||
| 12 | + :doc:`/gallery/scales/scales`. | ||
| 13 | + | ||
| 14 | + #. Create a custom scale class such as the one in this example, which implements | ||
| 15 | + the scaling use for latitude data in a Mercator Projection. This more complicated | ||
| 16 | + approach is useful when | ||
| 17 | + | ||
| 18 | + * You are making special use of the `.Transform` class, such as the special | ||
| 19 | + handling of values beyond the threshold in ``MercatorLatitudeTransform`` | ||
| 20 | + below. | ||
| 21 | + | ||
| 22 | + * You want to override the default locators and formatters for the axis | ||
| 23 | + (``set_default_locators_and_formatters`` below). | ||
| 24 | + | ||
| 25 | + * You want to limit the range of the the axis (``limit_range_for_scale`` below). | ||
| 10 | 26 | ||
| 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`. | ||
| 15 | 27 | """ | |
| 16 | 28 | ||
| 17 | 29 | import numpy as np | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -760,26 +760,15 @@ def _set_axes_scale(self, value, **kwargs): | |||
| 760 | 760 | ||
| 761 | 761 | Parameters | |
| 762 | 762 | ---------- | |
| 763 | - value : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase` | ||
| 764 | - The axis scale type to apply. | ||
| 763 | + value : str or `.ScaleBase` | ||
| 764 | + The axis scale type to apply. Valid string values are the names of scale | ||
| 765 | + classes ("linear", "log", "function",...). These may be the names of any | ||
| 766 | + of the :ref:`built-in scales<builtin_scales>` or of any custom scales | ||
| 767 | + registered using `matplotlib.scale.register_scale`. | ||
| 765 | 768 | ||
| 766 | 769 | **kwargs | |
| 767 | - Different keyword arguments are accepted, depending on the scale. | ||
| 768 | - See the respective class keyword arguments: | ||
| 769 | - | ||
| 770 | - - `matplotlib.scale.LinearScale` | ||
| 771 | - - `matplotlib.scale.LogScale` | ||
| 772 | - - `matplotlib.scale.SymmetricalLogScale` | ||
| 773 | - - `matplotlib.scale.LogitScale` | ||
| 774 | - - `matplotlib.scale.FuncScale` | ||
| 775 | - - `matplotlib.scale.AsinhScale` | ||
| 776 | - | ||
| 777 | - Notes | ||
| 778 | - ----- | ||
| 779 | - By default, Matplotlib supports the above-mentioned scales. | ||
| 780 | - Additionally, custom scales may be registered using | ||
| 781 | - `matplotlib.scale.register_scale`. These scales can then also | ||
| 782 | - be used here. | ||
| 770 | + If *value* is a string, keywords are passed to the instantiation method of | ||
| 771 | + the respective class. | ||
| 783 | 772 | """ | |
| 784 | 773 | name = self._get_axis_name() | |
| 785 | 774 | old_default_lims = (self.get_major_locator() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | 4 | The mapping is implemented through `.Transform` subclasses. | |
| 5 | 5 | ||
| 6 | - The following scales are builtin: | ||
| 6 | + The following scales are built-in: | ||
| 7 | + | ||
| 8 | + .. _builtin_scales: | ||
| 7 | 9 | ||
| 8 | 10 | ============= ===================== ================================ ================================= | |
| 9 | 11 | Name Class Transform Inverted transform | |
| Back | FazBrowse Home | New Git URL |
0 commit comments