|
1 | 1 | import matplotlib.pyplot as plt
|
2 | 2 | import numpy as np
|
3 |
| -from matplotlib.ticker import OldScalarFormatter, ScalarFormatter |
| 3 | +from matplotlib.ticker import ScalarFormatter |
4 | 4 |
|
5 | 5 | # Example 1
|
6 | 6 | x = np.arange(0, 1, .01)
|
7 | 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()) |
17 |
| - |
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()) |
21 |
| - |
22 |
| -ax4.plot(-x * 1e5, -x * 1e-4) |
23 |
| -ax4.xaxis.set_major_formatter(OldScalarFormatter()) |
24 |
| -ax4.yaxis.set_major_formatter(OldScalarFormatter()) |
25 |
| - |
26 |
| -fig.subplots_adjust(wspace=0.7, hspace=0.6) |
27 |
| - |
28 |
| -# Example 2 |
29 |
| -x = np.arange(0, 1, .01) |
30 |
| -fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) |
31 | 8 | fig.text(0.5, 0.975, 'The new formatter, default settings',
|
32 | 9 | horizontalalignment='center',
|
33 | 10 | verticalalignment='top')
|
|
50 | 27 |
|
51 | 28 | fig.subplots_adjust(wspace=0.7, hspace=0.6)
|
52 | 29 |
|
53 |
| -# Example 3 |
| 30 | +# Example 2 |
54 | 31 | x = np.arange(0, 1, .01)
|
55 | 32 | fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
|
56 | 33 | fig.text(0.5, 0.975, 'The new formatter, no numerical offset',
|
|
75 | 52 |
|
76 | 53 | fig.subplots_adjust(wspace=0.7, hspace=0.6)
|
77 | 54 |
|
78 |
| -# Example 4 |
| 55 | +# Example 3 |
79 | 56 | x = np.arange(0, 1, .01)
|
80 | 57 | fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
|
81 | 58 | fig.text(0.5, 0.975, 'The new formatter, with mathtext',
|
|
0 commit comments