From f5e2f36096725b170833522ee855a1375524b384 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 9 Jun 2020 01:38:23 +0200 Subject: [PATCH 1/2] Clarify docs of set_powerlimits() --- lib/matplotlib/ticker.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 192811d99c5b..b9430418d459 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -653,19 +653,28 @@ 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``. + + 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 -------- From 02af02bf756338ae76f41e16e5d5c87650aaeb36 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 9 Jun 2020 14:35:22 -0400 Subject: [PATCH 2/2] DOC: add reference to rcParams for axes.formatter.limits --- lib/matplotlib/ticker.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index b9430418d459..31dbf601e531 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -665,6 +665,8 @@ def set_powerlimits(self, lims): 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.