Skip to content

Commit 7978804

Browse files
committed
Numpydoc ticklabel_format.
Note that this intentionally does not list the defaults using the usual `parameter_name : type, default: default_value` because these are *not* the default values of the parameters (the method leaves unset parameters untouched on the formatter), just the defaults for the underlying formatter.
1 parent 154a936 commit 7978804

File tree

1 file changed

+41
-38
lines changed

1 file changed

+41
-38
lines changed

lib/matplotlib/axes/_base.py

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

0 commit comments

Comments
 (0)