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

Skip to content

Commit 93e63e5

Browse files
committed
Merge pull request #5125 from ericmjl/mep12-ellipse_demo.py
mep12 on ellipse_demo.py
2 parents 461da6c + 4db3fca commit 93e63e5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
from pylab import figure, show, rand
1+
import matplotlib.pyplot as plt
2+
import numpy.random as rnd
23
from matplotlib.patches import Ellipse
34

45
NUM = 250
56

6-
ells = [Ellipse(xy=rand(2)*10, width=rand(), height=rand(), angle=rand()*360)
7+
ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360)
78
for i in range(NUM)]
89

9-
fig = figure()
10+
fig = plt.figure(0)
1011
ax = fig.add_subplot(111, aspect='equal')
1112
for e in ells:
1213
ax.add_artist(e)
1314
e.set_clip_box(ax.bbox)
14-
e.set_alpha(rand())
15-
e.set_facecolor(rand(3))
15+
e.set_alpha(rnd.rand())
16+
e.set_facecolor(rnd.rand(3))
1617

1718
ax.set_xlim(0, 10)
1819
ax.set_ylim(0, 10)
1920

20-
show()
21+
plt.show()

0 commit comments

Comments
 (0)