# -*- coding: utf-8 -*- import numpy as np import matplotlib.patches as pa import matplotlib.pyplot as plt num = 200 # the number of ellipse def createEll(): ell = pa.Ellipse(xy=np.random.rand(2)*10, width=np.random.rand(), height=np.random.rand(), angle=np.random.rand()*360) return ell ells = [createEll() for i in range(num)] fig, ax = plt.subplots(subplot_kw={'aspect':'equal'}) fig.set_size_inches(6,6) for i in ells: ax.add_artist(i) i.set_alpha(np.random.rand()) i.set_facecolor(np.random.rand(3)) ax.set_xlim(0,10) ax.set_ylim(0,10) plt.title("Ellipses", fontsize=20, color='b')