draw circle plt pythob code example
Example 1: plt plot circle
import matplotlib.pyplot as plt
circle1 = plt.Circle((0, 0), 0.2, color='r')
circle2 = plt.Circle((0.5, 0.5), 0.2, color='blue')
circle3 = plt.Circle((1, 1), 0.2, color='g', clip_on=False)
fig, ax = plt.subplots()
ax.add_patch(circle1)
ax.add_patch(circle2)
ax.add_patch(circle3)
fig.savefig('plotcircles.png')
Example 2: plt plot circle
circle1 = plt.Circle((0, 0), 2, color='r')
circle2 = plt.Circle((5, 5), 0.5, color='b', fill=False)
circle3 = plt.Circle((10, 10), 2, color='g', clip_on=False)
ax = plt.gca()
ax.cla()
ax.set_xlim((0, 10))
ax.set_ylim((0, 10))
ax.plot(range(11), 'o', color='black')
ax.plot((5), (5), 'o', color='y')
ax.add_patch(circle1)
ax.add_patch(circle2)
ax.add_patch(circle3)
fig.savefig('plotcircles2.png')