Skip to content

Clarify docs of set_powerlimits() #17590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,19 +653,30 @@ def set_scientific(self, b):
self._scientific = bool(b)

def set_powerlimits(self, lims):
"""
Sets size thresholds for scientific notation.
r"""
Set size thresholds for scientific notation.

Parameters
----------
lims : (min_exp, max_exp)
A tuple containing the powers of 10 that determine the switchover
threshold. Numbers below ``10**min_exp`` and above ``10**max_exp``
will be displayed in scientific notation.

For example, ``formatter.set_powerlimits((-3, 4))`` sets the
pre-2007 default in which scientific notation is used for
numbers less than 1e-3 or greater than 1e4.
lims : (int, int)
A tuple *(min_exp, max_exp)* containing the powers of 10 that
determine the switchover threshold. For a number representable as
:math:`a \times 10^\mathrm{exp}`` with :math:`1 <= |a| < 10`,
scientific notation will be used if ``exp <= min_exp`` or
``exp >= max_exp``.

The default limits are controlled by :rc:`axes.formatter.limits`.

In particular numbers with *exp* equal to the thresholds are
written in scientific notation.

Typically, *min_exp* will be negative and *max_exp* will be
positive.

For example, ``formatter.set_powerlimits((-3, 4))`` will provide
the following formatting:
:math:`1 \times 10^{-3}, 9.9 \times 10^{-3}, 0.01,`
:math:`9999, 1 \times 10^4`.

See Also
--------
Expand Down