Clearing legend in GUI plot

46 views (last 30 days)
Amanda
Amanda on 21 Aug 2013
Answered: KAE on 18 Jul 2017
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

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 21 Aug 2013
Edited: Azzi Abdelmalek on 21 Aug 2013
legend('hide')
%for your GUI it is:
legend(handles.axes1,'hide')
  2 Comments
chlor thanks
chlor thanks on 11 Aug 2016
This works for my question too! Thanks Azzi!
Abdurrehman
Abdurrehman on 13 Jul 2017
Jazakallah o khair dear Azizi

Sign in to comment.


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

Community Treasure Hunt

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

Start Hunting!