What is the data structure referencing text labels?

This question is related to python - How to manage text labels in a simple interactive matplotlib plot? - Stack Overflow. In this code snippet:

import matplotlib.pyplot as plt
import numpy as np

def onclick(event):
  plt.text(event.xdata, event.ydata, f'x', color='black')

fig, ax = plt.subplots()
fig.canvas.mpl_connect('button_press_event', onclick)
data = np.random.rand(8, 8)
plt.imshow(data, origin='lower', interpolation='None', aspect='equal')

I’m adding x with each mouse click.


Where are references to these text labels stored? Is there a function call to remove all or some of them?