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

Skip to content

Commit 05a93a0

Browse files
committed
Merge pull request #5118 from ericmjl/mep12-figure_title.py
mep12 on figure_title.py
2 parents aa3c454 + c716e4e commit 05a93a0

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
#!/usr/bin/env python
21
from matplotlib.font_manager import FontProperties
3-
from pylab import *
2+
import matplotlib.pyplot as plt
3+
import numpy as np
44

55

66
def f(t):
7-
s1 = cos(2*pi*t)
8-
e1 = exp(-t)
9-
return multiply(s1, e1)
7+
s1 = np.cos(2*np.pi*t)
8+
e1 = np.exp(-t)
9+
return s1 * e1
1010

11-
t1 = arange(0.0, 5.0, 0.1)
12-
t2 = arange(0.0, 5.0, 0.02)
13-
t3 = arange(0.0, 2.0, 0.01)
11+
t1 = np.arange(0.0, 5.0, 0.1)
12+
t2 = np.arange(0.0, 5.0, 0.02)
13+
t3 = np.arange(0.0, 2.0, 0.01)
1414

1515

16-
subplot(121)
17-
plot(t1, f(t1), 'bo', t2, f(t2), 'k')
18-
title('subplot 1')
19-
ylabel('Damped oscillation')
20-
suptitle('This is a somewhat long figure title', fontsize=16)
16+
plt.subplot(121)
17+
plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
18+
plt.title('subplot 1')
19+
plt.ylabel('Damped oscillation')
20+
plt.suptitle('This is a somewhat long figure title', fontsize=16)
2121

2222

23-
subplot(122)
24-
plot(t3, cos(2*pi*t3), 'r--')
25-
xlabel('time (s)')
26-
title('subplot 2')
27-
ylabel('Undamped')
23+
plt.subplot(122)
24+
plt.plot(t3, np.cos(2*np.pi*t3), 'r--')
25+
plt.xlabel('time (s)')
26+
plt.title('subplot 2')
27+
plt.ylabel('Undamped')
2828

29-
show()
29+
plt.show()

0 commit comments

Comments
 (0)