Skip to content

Commit 4606c7b

Browse files
jklymakMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #11549: Some docstring cleanup in ticker
1 parent b56734e commit 4606c7b

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
@@ -267,7 +267,7 @@ class Formatter(TickHelper):
267267

268268
def __call__(self, x, pos=None):
269269
"""
270-
Return the format for tick value `x` at position pos.
270+
Return the format for tick value *x* at position pos.
271271
``pos=None`` indicates an unspecified location.
272272
"""
273273
raise NotImplementedError('Derived must override')
@@ -585,14 +585,16 @@ def set_powerlimits(self, lims):
585585
"""
586586
Sets size thresholds for scientific notation.
587587
588-
``lims`` is a two-element sequence containing the powers of 10
589-
that determine the switchover threshold. Numbers below
590-
``10**lims[0]`` and above ``10**lims[1]`` will be displayed in
591-
scientific notation.
588+
Parameters
589+
----------
590+
lims : (min_exp, max_exp)
591+
A tuple containing the powers of 10 that determine the switchover
592+
threshold. Numbers below ``10**min_exp`` and above ``10**max_exp``
593+
will be displayed in scientific notation.
592594
593-
For example, ``formatter.set_powerlimits((-3, 4))`` sets the
594-
pre-2007 default in which scientific notation is used for
595-
numbers less than 1e-3 or greater than 1e4.
595+
For example, ``formatter.set_powerlimits((-3, 4))`` sets the
596+
pre-2007 default in which scientific notation is used for
597+
numbers less than 1e-3 or greater than 1e4.
596598
597599
.. seealso:: Method :meth:`set_scientific`
598600
"""
@@ -882,7 +884,7 @@ def __init__(self, base=10.0, labelOnlyBase=False,
882884

883885
def base(self, base):
884886
"""
885-
change the `base` for labeling.
887+
Change the *base* for labeling.
886888
887889
.. warning::
888890
Should always match the base used for :class:`LogLocator`
@@ -906,7 +908,7 @@ def set_locs(self, locs=None):
906908
"""
907909
Use axis view limits to control which ticks are labeled.
908910
909-
The ``locs`` parameter is ignored in the present algorithm.
911+
The *locs* parameter is ignored in the present algorithm.
910912
911913
"""
912914
if np.isinf(self.minor_thresholds[0]):
@@ -973,7 +975,7 @@ def _num_to_string(self, x, vmin, vmax):
973975

974976
def __call__(self, x, pos=None):
975977
"""
976-
Return the format for tick val `x`.
978+
Return the format for tick val *x*.
977979
"""
978980
if x == 0.0: # Symlog
979981
return '0'
@@ -1073,9 +1075,9 @@ def _non_decade_format(self, sign_string, base, fx, usetex):
10731075

10741076
def __call__(self, x, pos=None):
10751077
"""
1076-
Return the format for tick value `x`.
1078+
Return the format for tick value *x*.
10771079
1078-
The position `pos` is ignored.
1080+
The position *pos* is ignored.
10791081
"""
10801082
usetex = rcParams['text.usetex']
10811083
min_exp = rcParams['axes.formatter.min_exponent']
@@ -1130,7 +1132,7 @@ def __call__(self, x, pos=None):
11301132

11311133
class LogFormatterSciNotation(LogFormatterMathtext):
11321134
"""
1133-
Format values following scientific notation in a logarithmic axis
1135+
Format values following scientific notation in a logarithmic axis.
11341136
"""
11351137

11361138
def _non_decade_format(self, sign_string, base, fx, usetex):
@@ -1303,20 +1305,27 @@ class PercentFormatter(Formatter):
13031305
"""
13041306
Format numbers as a percentage.
13051307
1306-
How the number is converted into a percentage is determined by the
1307-
`xmax` parameter. `xmax` is the data value that corresponds to 100%.
1308-
Percentages are computed as ``x / xmax * 100``. So if the data is
1309-
already scaled to be percentages, `xmax` will be 100. Another common
1310-
situation is where `xmax` is 1.0.
1311-
1312-
`symbol` is a string which will be appended to the label. It may be
1313-
`None` or empty to indicate that no symbol should be used. LaTeX
1314-
special characters are escaped in `symbol` whenever latex mode is
1315-
enabled, unless `is_latex` is `True`.
1316-
1317-
`decimals` is the number of decimal places to place after the point.
1318-
If it is set to `None` (the default), the number will be computed
1319-
automatically.
1308+
Parameters
1309+
----------
1310+
xmax : float
1311+
Determines how the number is converted into a percentage.
1312+
*xmax* is the data value that corresponds to 100%.
1313+
Percentages are computed as ``x / xmax * 100``. So if the data is
1314+
already scaled to be percentages, *xmax* will be 100. Another common
1315+
situation is where `xmax` is 1.0.
1316+
1317+
decimals : None or int
1318+
The number of decimal places to place after the point.
1319+
If *None* (the default), the number will be computed automatically.
1320+
1321+
symbol : string or None
1322+
A string that will be appended to the label. It may be
1323+
*None* or empty to indicate that no symbol should be used. LaTeX
1324+
special characters are escaped in *symbol* whenever latex mode is
1325+
enabled, unless *is_latex* is *True*.
1326+
1327+
is_latex : bool
1328+
If *False*, reserved LaTeX characters in *symbol* will be escaped.
13201329
"""
13211330
def __init__(self, xmax=100, decimals=None, symbol='%', is_latex=False):
13221331
self.xmax = xmax + 0.0

0 commit comments

Comments
 (0)