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

Skip to content

Commit be2368c

Browse files
committed
mep12 on fill_spiral.py
1 parent dae480d commit be2368c

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
#!/usr/bin/env python
1+
import matplotlib.pyplot as plt
2+
import numpy as np
23

3-
from pylab import *
4-
5-
theta = arange(0, 8*pi, 0.1)
4+
theta = np.arange(0, 8*np.pi, 0.1)
65
a = 1
76
b = .2
87

9-
for dt in arange(0, 2*pi, pi/2.0):
8+
for dt in np.arange(0, 2*np.pi, np.pi/2.0):
109

11-
x = a*cos(theta + dt)*exp(b*theta)
12-
y = a*sin(theta + dt)*exp(b*theta)
10+
x = a*np.cos(theta + dt)*np.exp(b*theta)
11+
y = a*np.sin(theta + dt)*np.exp(b*theta)
1312

14-
dt = dt + pi/4.0
13+
dt = dt + np.pi/4.0
1514

16-
x2 = a*cos(theta + dt)*exp(b*theta)
17-
y2 = a*sin(theta + dt)*exp(b*theta)
15+
x2 = a*np.cos(theta + dt)*np.exp(b*theta)
16+
y2 = a*np.sin(theta + dt)*np.exp(b*theta)
1817

19-
xf = concatenate((x, x2[::-1]))
20-
yf = concatenate((y, y2[::-1]))
18+
xf = np.concatenate((x, x2[::-1]))
19+
yf = np.concatenate((y, y2[::-1]))
2120

22-
p1 = fill(xf, yf)
21+
p1 = plt.fill(xf, yf)
2322

24-
show()
23+
plt.show()

0 commit comments

Comments
 (0)