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

Skip to content

Commit 67c753c

Browse files
committed
mep12 on pstest.py
1 parent 7539b61 commit 67c753c

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

examples/pylab_examples/pstest.py

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
#!/usr/bin/env python
2-
# -*- noplot -*-
3-
import matplotlib
4-
matplotlib.use('PS')
5-
from pylab import *
6-
1+
import matplotlib.pyplot as plt
2+
import numpy as np
73

84
def f(t):
9-
s1 = cos(2*pi*t)
10-
e1 = exp(-t)
11-
return multiply(s1, e1)
12-
13-
t1 = arange(0.0, 5.0, .1)
14-
t2 = arange(0.0, 5.0, 0.02)
15-
t3 = arange(0.0, 2.0, 0.01)
5+
s1 = np.cos(2*np.pi*t)
6+
e1 = np.exp(-t)
7+
return np.multiply(s1, e1)
168

17-
figure(1)
18-
subplot(211)
19-
l = plot(t1, f(t1), 'k^')
20-
setp(l, markerfacecolor='k', markeredgecolor='r')
21-
title('A tale of 2 subplots', fontsize=14, fontname='Courier')
22-
ylabel('Signal 1', fontsize=12)
23-
subplot(212)
24-
l = plot(t1, f(t1), 'k>')
9+
t1 = np.arange(0.0, 5.0, .1)
10+
t2 = np.arange(0.0, 5.0, 0.02)
11+
t3 = np.arange(0.0, 2.0, 0.01)
2512

13+
plt.figure(1)
14+
plt.subplot(211)
15+
l = plt.plot(t1, f(t1), 'k^')
16+
plt.setp(l, markerfacecolor='k', markeredgecolor='r')
17+
plt.title('A tale of 2 subplots', fontsize=14, fontname='Courier')
18+
plt.ylabel('Signal 1', fontsize=12)
19+
plt.subplot(212)
20+
l = plt.plot(t1, f(t1), 'k>')
2621

27-
ylabel('Signal 2', fontsize=12)
28-
xlabel('time (s)', fontsize=12)
22+
plt.ylabel('Signal 2', fontsize=12)
23+
plt.xlabel('time (s)', fontsize=12)
2924

30-
show()
25+
plt.show()

0 commit comments

Comments
 (0)