Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7a152d8

Browse filesBrowse files
authored
Merge pull request #8295 from NinadBhat/Suggested-improvements-to-the-gallery
Removes OldScalarFormatter closes #7956
2 parents a46b3ed + 375fd31 commit 7a152d8
Copy full SHA for 7a152d8

File tree

Expand file treeCollapse file tree

2 files changed

+16
-26
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-26
lines changed

‎examples/tests/backend_driver.py

Copy file name to clipboardExpand all lines: examples/tests/backend_driver.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
'multiline.py',
206206
'multiple_figs_demo.py',
207207
'nan_test.py',
208-
'newscalarformatter_demo.py',
208+
'plot_scalarformatter.py',
209209
'pcolor_demo.py',
210210
'pcolor_log.py',
211211
'pcolor_small.py',

‎examples/pylab_examples/newscalarformatter_demo.py renamed to ‎examples/ticks_and_spines/plot_scalarformatter.py

Copy file name to clipboardExpand all lines: examples/ticks_and_spines/plot_scalarformatter.py
+15-25Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
1-
import matplotlib.pyplot as plt
2-
import numpy as np
3-
from matplotlib.ticker import OldScalarFormatter, ScalarFormatter
1+
"""
2+
=========================================
3+
Tick formatting using the ScalarFromatter
4+
=========================================
45
5-
# Example 1
6-
x = np.arange(0, 1, .01)
7-
fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
8-
fig.text(0.5, 0.975, 'The old formatter',
9-
horizontalalignment='center', verticalalignment='top')
10-
ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)
11-
ax1.xaxis.set_major_formatter(OldScalarFormatter())
12-
ax1.yaxis.set_major_formatter(OldScalarFormatter())
13-
14-
ax2.plot(x * 1e5, x * 1e-4)
15-
ax2.xaxis.set_major_formatter(OldScalarFormatter())
16-
ax2.yaxis.set_major_formatter(OldScalarFormatter())
6+
The example shows use of ScalarFormatter with different settings.
177
18-
ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)
19-
ax3.xaxis.set_major_formatter(OldScalarFormatter())
20-
ax3.yaxis.set_major_formatter(OldScalarFormatter())
8+
Example 1 : Default
219
22-
ax4.plot(-x * 1e5, -x * 1e-4)
23-
ax4.xaxis.set_major_formatter(OldScalarFormatter())
24-
ax4.yaxis.set_major_formatter(OldScalarFormatter())
10+
Example 2 : With no Numerical Offset
2511
26-
fig.subplots_adjust(wspace=0.7, hspace=0.6)
12+
Example 3 : With Mathtext
13+
"""
14+
import matplotlib.pyplot as plt
15+
import numpy as np
16+
from matplotlib.ticker import ScalarFormatter
2717

28-
# Example 2
18+
# Example 1
2919
x = np.arange(0, 1, .01)
3020
fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
3121
fig.text(0.5, 0.975, 'The new formatter, default settings',
@@ -50,7 +40,7 @@
5040

5141
fig.subplots_adjust(wspace=0.7, hspace=0.6)
5242

53-
# Example 3
43+
# Example 2
5444
x = np.arange(0, 1, .01)
5545
fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
5646
fig.text(0.5, 0.975, 'The new formatter, no numerical offset',
@@ -75,7 +65,7 @@
7565

7666
fig.subplots_adjust(wspace=0.7, hspace=0.6)
7767

78-
# Example 4
68+
# Example 3
7969
x = np.arange(0, 1, .01)
8070
fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
8171
fig.text(0.5, 0.975, 'The new formatter, with mathtext',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.