hiding legend in plot
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (2)
Sean de Wolski
el 4 de Dic. de 2012
Get the handle form the legend when you create it
hLeg = legend('example')
Then turn its visibility off
set(hLeg,'visible','off')
1 comentario
Nirjhar Kumar
el 1 de Abr. de 2019
Editada: Nirjhar Kumar
el 1 de Abr. de 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
el 5 de Dic. de 2012
2 votos
2 comentarios
Payam Nia
el 24 de Sept. de 2015
b = gca; legend(b,'off');
Marco A. Acevedo Z.
el 8 de Mayo de 2023
thanks Payam.
Categorías
Más información sobre Legend en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!