How do I delete all annotations on a figure but not do clf?

How do I delete all annotations on a Figure? I do not want to do "clf" since that loses attributes that I want to keep. Doing "cla" does not remove the annotations.

 Accepted Answer

Please use the below command to delete all the annotations on a figure:
>>delete(findall(gcf,'type','annotation'))

2 Comments

Thank you. Readable, works, and simpler than any other method I found.

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!