MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / ticklabel_format

Method ticklabel_format

lib/matplotlib/axes/_base.py:3486–3562  ·  view source on GitHub ↗

r""" Configure the `.ScalarFormatter` used by default for linear Axes. If a parameter is not set, the corresponding property of the formatter is left unchanged. Parameters ---------- axis : {'x', 'y', 'both'}, default: 'both' The axis to

(self, *, axis='both', style=None, scilimits=None,
                         useOffset=None, useLocale=None, useMathText=None)

Source from the content-addressed store, hash-verified

3484 self.yaxis.grid(visible, which=which, **kwargs)
3485
3486 def ticklabel_format(self, *, axis='both', style=None, scilimits=None,
3487 useOffset=None, useLocale=None, useMathText=None):
3488 r"""
3489 Configure the `.ScalarFormatter` used by default for linear Axes.
3490
3491 If a parameter is not set, the corresponding property of the formatter
3492 is left unchanged.
3493
3494 Parameters
3495 ----------
3496 axis : {'x', 'y', 'both'}, default: 'both'
3497 The axis to configure. Only major ticks are affected.
3498
3499 style : {'sci', 'scientific', 'plain'}
3500 Whether to use scientific notation.
3501 The formatter default is to use scientific notation.
3502 'sci' is equivalent to 'scientific'.
3503
3504 scilimits : pair of ints (m, n)
3505 Scientific notation is used only for numbers outside the range
3506 10\ :sup:`m` to 10\ :sup:`n` (and only if the formatter is
3507 configured to use scientific notation at all). Use (0, 0) to
3508 include all numbers. Use (m, m) where m != 0 to fix the order of
3509 magnitude to 10\ :sup:`m`.
3510 The formatter default is :rc:`axes.formatter.limits`.
3511
3512 useOffset : bool or float
3513 If True, the offset is calculated as needed.
3514 If False, no offset is used.
3515 If a numeric value, it sets the offset.
3516 The formatter default is :rc:`axes.formatter.useoffset`.
3517
3518 useLocale : bool
3519 Whether to format the number using the current locale or using the
3520 C (English) locale. This affects e.g. the decimal separator. The
3521 formatter default is :rc:`axes.formatter.use_locale`.
3522
3523 useMathText : bool
3524 Render the offset and scientific notation in mathtext.
3525 The formatter default is :rc:`axes.formatter.use_mathtext`.
3526
3527 Raises
3528 ------
3529 AttributeError
3530 If the current formatter is not a `.ScalarFormatter`.
3531 """
3532 if isinstance(style, str):
3533 style = style.lower()
3534 axis = axis.lower()
3535 if scilimits is not None:
3536 try:
3537 m, n = scilimits
3538 m + n + 1 # check that both are numbers
3539 except (ValueError, TypeError) as err:
3540 raise ValueError("scilimits must be a sequence of 2 integers"
3541 ) from err
3542 STYLES = {'sci': True, 'scientific': True, 'plain': False, '': None, None: None}
3543 # The '' option is included for backwards-compatibility.

Callers 4

test_ticklabel_formatFunction · 0.80
ticklabel_formatFunction · 0.80
test_axis_method_errorsFunction · 0.80
scalarformatter.pyFile · 0.80

Calls 6

valuesMethod · 0.80
set_scientificMethod · 0.80
set_powerlimitsMethod · 0.80
set_useOffsetMethod · 0.80
set_useLocaleMethod · 0.80
set_useMathTextMethod · 0.80

Tested by 2

test_ticklabel_formatFunction · 0.64
test_axis_method_errorsFunction · 0.64