hiding legend in plot
Ältere Kommentare anzeigen
Dear All,
I want to hide one legend from my graph. Could you please suggest a procedure or steps to do it.
Here is the code below to hiding my legend but doesn't work.
legend(h4,'off')
legend(h4,'toggle')
legend('h1','h2', 'h3', 'h4','h5');
Many Thanks in advance
Babai
Akzeptierte Antwort
Weitere Antworten (2)
Sean de Wolski
am 4 Dez. 2012
Get the handle form the legend when you create it
hLeg = legend('example')
Then turn its visibility off
set(hLeg,'visible','off')
1 Kommentar
Nirjhar Kumar
am 1 Apr. 2019
Bearbeitet: Nirjhar Kumar
am 1 Apr. 2019
in case you dont have the any handle:
hFig=findall(0,'type','figure');
hLeg=findobj(hFig(1,1),'type','legend');
set(hLeg,'visible','off')
Sayanta
am 5 Dez. 2012
2 Stimmen
2 Kommentare
Payam Nia
am 24 Sep. 2015
b = gca; legend(b,'off');
Marco A. Acevedo Z.
am 8 Mai 2023
thanks Payam.
Kategorien
Mehr zu Legend finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!