|
1 | | -import pylab |
| 1 | +import numpy as np |
| 2 | +import matplotlib.pyplot as plt |
2 | 3 |
|
3 | | -x = pylab.rand(10) |
4 | | -y = pylab.rand(10) |
5 | 4 |
|
6 | | -pylab.subplot(321) |
7 | | -pylab.scatter(x,y,s=80,marker=">") |
| 5 | +x = np.random.rand(10) |
| 6 | +y = np.random.rand(10) |
| 7 | +z = np.sqrt(x**2 + y**2) |
8 | 8 |
|
9 | | -pylab.subplot(322) |
10 | | -pylab.scatter(x,y,s=80,marker=(5,0)) |
| 9 | +plt.subplot(321) |
| 10 | +plt.scatter(x,y,s=80, c=z, marker=">") |
| 11 | + |
| 12 | +plt.subplot(322) |
| 13 | +plt.scatter(x,y,s=80, c=z, marker=(5,0)) |
11 | 14 |
|
12 | 15 | verts = zip([-1.,1.,1.,-1.],[-1.,-1.,1.,-1.]) |
13 | | -pylab.subplot(323) |
14 | | -pylab.scatter(x,y,s=80,marker=(verts,0)) |
| 16 | +plt.subplot(323) |
| 17 | +plt.scatter(x,y,s=80, c=z, marker=(verts,0)) |
15 | 18 | # equivalent: |
16 | | -#pylab.scatter(x,y,s=80,marker=None, verts=verts) |
| 19 | +#plt.scatter(x,y,s=80, c=z, marker=None, verts=verts) |
17 | 20 |
|
18 | | -pylab.subplot(324) |
19 | | -pylab.scatter(x,y,s=80,marker=(5,1)) |
| 21 | +plt.subplot(324) |
| 22 | +plt.scatter(x,y,s=80, c=z, marker=(5,1)) |
20 | 23 |
|
21 | | -pylab.subplot(325) |
22 | | -pylab.scatter(x,y,s=80,marker='+') |
| 24 | +plt.subplot(325) |
| 25 | +plt.scatter(x,y,s=80, c=z, marker='+') |
23 | 26 |
|
24 | | -pylab.subplot(326) |
25 | | -pylab.scatter(x,y,s=80,marker=(5,2), edgecolor='g') |
| 27 | +plt.subplot(326) |
| 28 | +plt.scatter(x,y,s=80, c=z, marker=(5,2)) |
26 | 29 |
|
27 | | -pylab.show() |
| 30 | +plt.show() |
0 commit comments