Can we change legend value without re-run the whole code?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
SANDEEP SINGH RANA
il 19 Ago 2021
Risposto: Walter Roberson
il 19 Ago 2021
Hi,
Can I change the legend value without re-run the whole code as running whole code will take around 12 hours?
By mistake in the legend, I have written " user-1 , user-1" instead of " user-1, user-2".
How can I modified the plot? I did find any field to modify this.
Please help.
0 Commenti
Risposta accettata
Walter Roberson
il 19 Ago 2021
L = findobj(gcf, 'type', 'legend');
L.String{4} = 'user-2'; %to change the 4th legend
if you have multiple legends in the figure, you will have to select the correct entry in L.
I used gcf instead of gca because you might well not happen to have the correct axes as the "current" one.
If you are using App Designer then the gcf will probably not work, and you might need groot instead of gcf and you might possibly need findall instead of findobj
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Legend in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!