Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db92807

Browse files
authored
Merge pull request #15137 from tacaswell/doc_default_limits
DOC: add example to power limit API change note
2 parents 8ed7c78 + cb2b814 commit db92807

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
Reduced default value of :rc:`axes.formatter.limits`
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33

4-
Changed the default value of :rc:`axes.formatter.limits` from -7, 7 to -5, 6 for better readability.
4+
Changed the default value of :rc:`axes.formatter.limits` from -7, 7 to
5+
-5, 6 for better readability.
6+
7+
.. plot::
8+
9+
import matplotlib.pyplot as plt
10+
import numpy as np
11+
12+
fig, (ax_old, ax_new) = plt.subplots(1, 2, constrained_layout=True)
13+
14+
ax_new.set_title('new values (-5, 6)')
15+
ax_old.set_title('old values (-7, 7)')
16+
17+
x = np.logspace(-8, 8, 1024)
18+
y = 1e-5 * np.exp(-x / 1e5) + 1e-6
19+
20+
ax_old.xaxis.get_major_formatter().set_powerlimits((-7, 7))
21+
ax_old.yaxis.get_major_formatter().set_powerlimits((-7, 7))
22+
23+
for ax in [ax_new, ax_old]:
24+
ax.plot(x, y)
25+
ax.set_xlim(0, 1e6)
26+
ax.set_ylim(1e-6, 1e-5)
File renamed without changes.

0 commit comments

Comments
 (0)