Clearing legend in GUI plot

Hello all,
I'm working on my first GUI and I am having trouble getting the legend to clear/hide when I hide a figure. I am able to hide the axes and the data plot using 'cla' but I can't figure out how to make the legend go away.
Any thoughts would be much appreciated! -Amanda

Réponses (2)

Azzi Abdelmalek
Azzi Abdelmalek le 21 Août 2013
Modifié(e) : Azzi Abdelmalek le 21 Août 2013

6 votes

legend('hide')
%for your GUI it is:
legend(handles.axes1,'hide')

2 commentaires

chlor thanks
chlor thanks le 11 Août 2016
This works for my question too! Thanks Azzi!
Abdurrehman
Abdurrehman le 13 Juil 2017
Jazakallah o khair dear Azizi

Connectez-vous pour commenter.

KAE
KAE le 18 Juil 2017

5 votes

If you instead want to delete the legend from your GUI rather than hide it,
legend(handles.axes1, 'off');

Question posée :

le 21 Août 2013

Réponse apportée :

KAE
le 18 Juil 2017

Community Treasure Hunt

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

Start Hunting!

Translated by