|
1 |
| - |
2 | 1 | """
|
3 | 2 | I'm not trying to make a good looking figure here, but just to show
|
4 | 3 | some examples of customizing rc params on the fly
|
@@ -26,26 +25,26 @@ def set_pub():
|
26 | 25 | >>> rcdefaults() # restore the defaults
|
27 | 26 |
|
28 | 27 | """
|
29 |
| -from pylab import * |
| 28 | +import matplotlib.pyplot as plt |
30 | 29 |
|
31 |
| -subplot(311) |
32 |
| -plot([1, 2, 3]) |
| 30 | +plt.subplot(311) |
| 31 | +plt.plot([1, 2, 3]) |
33 | 32 |
|
34 | 33 | # the axes attributes need to be set before the call to subplot
|
35 |
| -rc('font', weight='bold') |
36 |
| -rc('xtick.major', size=5, pad=7) |
37 |
| -rc('xtick', labelsize=15) |
| 34 | +plt.rc('font', weight='bold') |
| 35 | +plt.rc('xtick.major', size=5, pad=7) |
| 36 | +plt.rc('xtick', labelsize=15) |
38 | 37 |
|
39 | 38 | # using aliases for color, linestyle and linewidth; gray, solid, thick
|
40 |
| -rc('grid', c='0.5', ls='-', lw=5) |
41 |
| -rc('lines', lw=2, color='g') |
42 |
| -subplot(312) |
43 |
| - |
44 |
| -plot([1, 2, 3]) |
45 |
| -grid(True) |
46 |
| - |
47 |
| -rcdefaults() |
48 |
| -subplot(313) |
49 |
| -plot([1, 2, 3]) |
50 |
| -grid(True) |
51 |
| -show() |
| 39 | +plt.rc('grid', c='0.5', ls='-', lw=5) |
| 40 | +plt.rc('lines', lw=2, color='g') |
| 41 | +plt.subplot(312) |
| 42 | + |
| 43 | +plt.plot([1, 2, 3]) |
| 44 | +plt.grid(True) |
| 45 | + |
| 46 | +plt.rcdefaults() |
| 47 | +plt.subplot(313) |
| 48 | +plt.plot([1, 2, 3]) |
| 49 | +plt.grid(True) |
| 50 | +plt.show() |
0 commit comments