|
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 |
7 | 3 |
|
8 | 4 | 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) |
16 | 8 |
|
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) |
25 | 12 |
|
| 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>') |
26 | 21 |
|
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) |
29 | 24 |
|
30 |
| -show() |
| 25 | +plt.show() |
0 commit comments