1import matplotlib.pyplot as plt
2
3circle1 = plt.Circle((0, 0), 0.2, color='r')
4circle2 = plt.Circle((0.5, 0.5), 0.2, color='blue')
5circle3 = plt.Circle((1, 1), 0.2, color='g', clip_on=False)
6
7fig, ax = plt.subplots() # note we must use plt.subplots, not plt.subplot
8# (or if you have an existing figure)
9# fig = plt.gcf()
10# ax = fig.gca()
11
12ax.add_patch(circle1)
13ax.add_patch(circle2)
14ax.add_patch(circle3)
15
16fig.savefig('plotcircles.png')
17