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

Skip to content

Commit f37e6ef

Browse files
committed
Merge pull request #4664 from domspad/MEP12-on-axis_equal_demo.py
MEP12 on axis_equal_demo.py
2 parents b8d7e25 + b328cbb commit f37e6ef

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
'''This example is only interesting when ran in interactive mode'''
22

3-
from pylab import *
3+
import matplotlib.pyplot as plt
4+
import numpy as np
45

56
# Plot circle or radius 3
67

7-
an = linspace(0, 2*pi, 100)
8+
an = np.linspace(0, 2*np.pi, 100)
89

9-
subplot(221)
10-
plot(3*cos(an), 3*sin(an))
11-
title('not equal, looks like ellipse', fontsize=10)
10+
plt.subplot(221)
11+
plt.plot(3*np.cos(an), 3*np.sin(an))
12+
plt.title('not equal, looks like ellipse', fontsize=10)
1213

13-
subplot(222)
14-
plot(3*cos(an), 3*sin(an))
15-
axis('equal')
16-
title('equal, looks like circle', fontsize=10)
14+
plt.subplot(222)
15+
plt.plot(3*np.cos(an), 3*np.sin(an))
16+
plt.axis('equal')
17+
plt.title('equal, looks like circle', fontsize=10)
1718

18-
subplot(223)
19-
plot(3*cos(an), 3*sin(an))
20-
axis('equal')
21-
axis([-3, 3, -3, 3])
22-
title('looks like circle, even after changing limits', fontsize=10)
19+
plt.subplot(223)
20+
plt.plot(3*np.cos(an), 3*np.sin(an))
21+
plt.axis('equal')
22+
plt.axis([-3, 3, -3, 3])
23+
plt.title('looks like circle, even after changing limits', fontsize=10)
2324

24-
subplot(224)
25-
plot(3*cos(an), 3*sin(an))
26-
axis('equal')
27-
axis([-3, 3, -3, 3])
28-
plot([0, 4], [0, 4])
29-
title('still equal after adding line', fontsize=10)
25+
plt.subplot(224)
26+
plt.plot(3*np.cos(an), 3*np.sin(an))
27+
plt.axis('equal')
28+
plt.axis([-3, 3, -3, 3])
29+
plt.plot([0, 4], [0, 4])
30+
plt.title('still equal after adding line', fontsize=10)
3031

31-
show()
32+
plt.show()

0 commit comments

Comments
 (0)