Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9fc98c9

Browse files
authored
Merge pull request #11549 from timhoffm/doc-ticker
Some docstring cleanup in ticker
2 parents 50b1abf + bdde7e0 commit 9fc98c9

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

lib/matplotlib/ticker.py

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class Formatter(TickHelper):
259259

260260
def __call__(self, x, pos=None):
261261
"""
262-
Return the format for tick value `x` at position pos.
262+
Return the format for tick value *x* at position pos.
263263
``pos=None`` indicates an unspecified location.
264264
"""
265265
raise NotImplementedError('Derived must override')
@@ -577,14 +577,16 @@ def set_powerlimits(self, lims):
577577
"""
578578
Sets size thresholds for scientific notation.
579579
580-
``lims`` is a two-element sequence containing the powers of 10
581-
that determine the switchover threshold. Numbers below
582-
``10**lims[0]`` and above ``10**lims[1]`` will be displayed in
583-
scientific notation.
580+
Parameters
581+
----------
582+
lims : (min_exp, max_exp)
583+
A tuple containing the powers of 10 that determine the switchover
584+
threshold. Numbers below ``10**min_exp`` and above ``10**max_exp``
585+
will be displayed in scientific notation.
584586
585-
For example, ``formatter.set_powerlimits((-3, 4))`` sets the
586-
pre-2007 default in which scientific notation is used for
587-
numbers less than 1e-3 or greater than 1e4.
587+
For example, ``formatter.set_powerlimits((-3, 4))`` sets the
588+
pre-2007 default in which scientific notation is used for
589+
numbers less than 1e-3 or greater than 1e4.
588590
589591
.. seealso:: Method :meth:`set_scientific`
590592
"""
@@ -878,7 +880,7 @@ def __init__(self, base=10.0, labelOnlyBase=False,
878880

879881
def base(self, base):
880882
"""
881-
change the `base` for labeling.
883+
Change the *base* for labeling.
882884
883885
.. warning::
884886
Should always match the base used for :class:`LogLocator`
@@ -902,7 +904,7 @@ def set_locs(self, locs=None):
902904
"""
903905
Use axis view limits to control which ticks are labeled.
904906
905-
The ``locs`` parameter is ignored in the present algorithm.
907+
The *locs* parameter is ignored in the present algorithm.
906908
907909
"""
908910
if np.isinf(self.minor_thresholds[0]):
@@ -969,7 +971,7 @@ def _num_to_string(self, x, vmin, vmax):
969971

970972
def __call__(self, x, pos=None):
971973
"""
972-
Return the format for tick val `x`.
974+
Return the format for tick val *x*.
973975
"""
974976
if x == 0.0: # Symlog
975977
return '0'
@@ -1069,9 +1071,9 @@ def _non_decade_format(self, sign_string, base, fx, usetex):
10691071

10701072
def __call__(self, x, pos=None):
10711073
"""
1072-
Return the format for tick value `x`.
1074+
Return the format for tick value *x*.
10731075
1074-
The position `pos` is ignored.
1076+
The position *pos* is ignored.
10751077
"""
10761078
usetex = rcParams['text.usetex']
10771079
min_exp = rcParams['axes.formatter.min_exponent']
@@ -1121,7 +1123,7 @@ def __call__(self, x, pos=None):
11211123

11221124
class LogFormatterSciNotation(LogFormatterMathtext):
11231125
"""
1124-
Format values following scientific notation in a logarithmic axis
1126+
Format values following scientific notation in a logarithmic axis.
11251127
"""
11261128

11271129
def _non_decade_format(self, sign_string, base, fx, usetex):
@@ -1282,20 +1284,27 @@ class PercentFormatter(Formatter):
12821284
"""
12831285
Format numbers as a percentage.
12841286
1285-
How the number is converted into a percentage is determined by the
1286-
`xmax` parameter. `xmax` is the data value that corresponds to 100%.
1287-
Percentages are computed as ``x / xmax * 100``. So if the data is
1288-
already scaled to be percentages, `xmax` will be 100. Another common
1289-
situation is where `xmax` is 1.0.
1290-
1291-
`symbol` is a string which will be appended to the label. It may be
1292-
`None` or empty to indicate that no symbol should be used. LaTeX
1293-
special characters are escaped in `symbol` whenever latex mode is
1294-
enabled, unless `is_latex` is `True`.
1295-
1296-
`decimals` is the number of decimal places to place after the point.
1297-
If it is set to `None` (the default), the number will be computed
1298-
automatically.
1287+
Parameters
1288+
----------
1289+
xmax : float
1290+
Determines how the number is converted into a percentage.
1291+
*xmax* is the data value that corresponds to 100%.
1292+
Percentages are computed as ``x / xmax * 100``. So if the data is
1293+
already scaled to be percentages, *xmax* will be 100. Another common
1294+
situation is where `xmax` is 1.0.
1295+
1296+
decimals : None or int
1297+
The number of decimal places to place after the point.
1298+
If *None* (the default), the number will be computed automatically.
1299+
1300+
symbol : string or None
1301+
A string that will be appended to the label. It may be
1302+
*None* or empty to indicate that no symbol should be used. LaTeX
1303+
special characters are escaped in *symbol* whenever latex mode is
1304+
enabled, unless *is_latex* is *True*.
1305+
1306+
is_latex : bool
1307+
If *False*, reserved LaTeX characters in *symbol* will be escaped.
12991308
"""
13001309
def __init__(self, xmax=100, decimals=None, symbol='%', is_latex=False):
13011310
self.xmax = xmax + 0.0

0 commit comments

Comments
 (0)