Created
February 16, 2016 11:02
-
-
Save jonnyhtw/602189c6efc9237874c0 to your computer and use it in GitHub Desktop.
ellipse_demo.py from http://matplotlib.org/examples/pylab_examples/ellipse_demo.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy.random as rnd | |
from matplotlib.patches import Ellipse | |
NUM = 250 | |
ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360) | |
for i in range(NUM)] | |
fig = plt.figure(0) | |
ax = fig.add_subplot(111, aspect='equal') | |
for e in ells: | |
ax.add_artist(e) | |
e.set_clip_box(ax.bbox) | |
e.set_alpha(rnd.rand()) | |
e.set_facecolor(rnd.rand(3)) | |
ax.set_xlim(0, 10) | |
ax.set_ylim(0, 10) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment