Skip to content

Commit 696be2c

Browse files
authored
Merge pull request #16194 from anntzer/ticklabel_format
Numpydoc ticklabel_format.
2 parents 60b3f54 + 7978804 commit 696be2c

File tree

1 file changed

+41
-38
lines changed

1 file changed

+41
-38
lines changed

lib/matplotlib/axes/_base.py

+41-38
Original file line numberDiff line numberDiff line change
@@ -2826,44 +2826,47 @@ def grid(self, b=None, which='major', axis='both', **kwargs):
28262826
def ticklabel_format(self, *, axis='both', style='', scilimits=None,
28272827
useOffset=None, useLocale=None, useMathText=None):
28282828
r"""
2829-
Change the `~matplotlib.ticker.ScalarFormatter` used by
2830-
default for linear axes.
2831-
2832-
Optional keyword arguments:
2833-
2834-
============== =========================================
2835-
Keyword Description
2836-
============== =========================================
2837-
*axis* {'x', 'y', 'both'}
2838-
*style* {'sci' (or 'scientific'), 'plain'}
2839-
plain turns off scientific notation
2840-
*scilimits* (m, n), pair of integers; if *style*
2841-
is 'sci', scientific notation will
2842-
be used for numbers outside the range
2843-
10\ :sup:`m` to 10\ :sup:`n`.
2844-
Use (0, 0) to include all numbers.
2845-
Use (m, m) where m != 0 to fix the order
2846-
of magnitude to 10\ :sup:`m`.
2847-
*useOffset* bool or float
2848-
If True, the offset will be calculated as
2849-
needed; if False, no offset will be used;
2850-
if a numeric offset is specified, it will
2851-
be used.
2852-
*useLocale* If True, format the number according to
2853-
the current locale. This affects things
2854-
such as the character used for the
2855-
decimal separator. If False, use
2856-
C-style (English) formatting. The
2857-
default setting is controlled by the
2858-
axes.formatter.use_locale rcparam.
2859-
*useMathText* If True, render the offset and scientific
2860-
notation in mathtext
2861-
============== =========================================
2862-
2863-
Only the major ticks are affected.
2864-
If the method is called when the `~matplotlib.ticker.ScalarFormatter`
2865-
is not the `~matplotlib.ticker.Formatter` being used, an
2866-
`AttributeError` will be raised.
2829+
Configure the `.ScalarFormatter` used by default for linear axes.
2830+
2831+
If a parameter is not set, the corresponding property of the formatter
2832+
is left unchanged.
2833+
2834+
Parameters
2835+
----------
2836+
axis : {'x', 'y', 'both'}, default: 'both'
2837+
The axes to configure. Only major ticks are affected.
2838+
2839+
style : {'sci', 'scientific', 'plain'}
2840+
Whether to use scientific notation.
2841+
The formatter default is to use scientific notation.
2842+
2843+
scilimits : pair of ints (m, n)
2844+
Scientific notation is used only for numbers outside the range
2845+
10\ :sup:`m` to 10\ :sup:`n` (and only if the formatter is
2846+
configured to use scientific notation at all). Use (0, 0) to
2847+
include all numbers. Use (m, m) where m != 0 to fix the order of
2848+
magnitude to 10\ :sup:`m`.
2849+
The formatter default is :rc:`axes.formatter.limits`.
2850+
2851+
useOffset : bool or float
2852+
If True, the offset is calculated as needed.
2853+
If False, no offset is used.
2854+
If a numeric value, it sets the offset.
2855+
The formatter default is :rc:`axes.formatter.useoffset`.
2856+
2857+
useLocale : bool
2858+
Whether to format the number using the current locale or using the
2859+
C (English) locale. This affects e.g. the decimal separator. The
2860+
formatter default is :rc:`axes.formatter.use_locale`.
2861+
2862+
useMathText : bool
2863+
Render the offset and scientific notation in mathtext.
2864+
The formatter default is :rc:`axes.formatter.use_mathtext`.
2865+
2866+
Raises
2867+
------
2868+
AttributeError
2869+
If the current formatter is not a `.ScalarFormatter`.
28672870
"""
28682871
style = style.lower()
28692872
axis = axis.lower()

0 commit comments

Comments
 (0)