Is it possible to get a list of current annotations and to delete the ones I don't want?

Hi there,

I’ve been adding annotations to a figure using fig.add_annotations(...) . However I want to be able to access the current annotations of a figure object and delete the ones I don’t want.

Many thanks.

Here is an example on how to create annotations. Deleting them would be just deleting the corresponding list entry.

A figure’s annotations are stored in a tuple in fig.layout.annotations.
I don’t know about deleting them, but say you want to hide the i_th annotation :

fig.layout.annotations[i].visible = False

Found from the doc here : Layout.annotations in Python