[ACCEPTED]-MatplotLib get all annotation by axes-tkinter-canvas

Accepted answer
Score: 14

You could loop over all the ax children and 2 check if the child is of type matplotlib.text.Annotation:

for child in ax.get_children():
    if isinstance(child, matplotlib.text.Annotation):
        print("bingo") # and do something

Or, if you 1 want a list:

annotations = [child for child in ax.get_children() if isinstance(child, matplotlib.text.Annotation)]

More Related questions