Matplotlib remove patches from figure
Different options is this
def reset(event):
ax.patches = []
it removes all the patches. This option was viable for Matplotlib < 3.5.0.
With Matplotlib 3.5.0 you get the error AttributeError: can't set attribute
In that case, you can use the following option
def reset(event):
ax.patches.pop()
# Statement below is optional
fig.canvas.draw()
Try this:
def reset(event):
circle1.remove()
Also maybe you prefer:
def reset(event):
circle1.set_visible(False)