plt.text remove code example
Example: matplotlib remove drawn text
# instead of drawing your text like this
fig.text(0, 0, 'My text')
# you can do
textvar = fig.text(0, 0, 'My text')
# If you've lost the references, though, all the text objects
# can be found in the texts attribute:
fig.texts # is a list of Text objects
# In version 1.3.1, doing textvar.remove() generates a NotImplementedError
# (apparently fixed in 1.4). However, you can get around that to some
# degree by setting the visibility to False.
for txt in fig.texts:
txt.set_visible(False)