Clearing legend in GUI plot

36 次查看(过去 30 天)
Amanda
Amanda 2013-8-21
回答: KAE 2017-7-18
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

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-8-21
编辑:Azzi Abdelmalek 2013-8-21
legend('hide')
%for your GUI it is:
legend(handles.axes1,'hide')
  2 个评论
chlor thanks
chlor thanks 2016-8-11
This works for my question too! Thanks Azzi!
Abdurrehman
Abdurrehman 2017-7-13
Jazakallah o khair dear Azizi

请先登录,再进行评论。


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

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by