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

Skip to content

Commit 1b4e122

Browse files
committed
Merge pull request #5126 from ericmjl/mep12-customize_rc.py
mep12 on customize_rc.py
2 parents 4bae415 + d20a0f9 commit 1b4e122

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

examples/pylab_examples/customize_rc.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
"""
32
I'm not trying to make a good looking figure here, but just to show
43
some examples of customizing rc params on the fly
@@ -26,26 +25,26 @@ def set_pub():
2625
>>> rcdefaults() # restore the defaults
2726
2827
"""
29-
from pylab import *
28+
import matplotlib.pyplot as plt
3029

31-
subplot(311)
32-
plot([1, 2, 3])
30+
plt.subplot(311)
31+
plt.plot([1, 2, 3])
3332

3433
# 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)
3837

3938
# 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

Comments
 (0)