Plot figure - get title
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
heidi pham
il 26 Gen 2019
Risposto: Star Strider
il 26 Gen 2019
Hello,
I am reading the following code, and I do not understand the last two lines. I run it, but it does not change the figure. So I am quite confused what are the purpose of the these code lines?
Is there anyone having an idea? If so, could you kindly tell me?
Thanks a lot!
figure;
plot(xx,yy,'LineWidth',2);
axis([-1 1 -0.2 1.2] )
h = legend(['f*';'10';'Ch']);
v = get(h,'title'); % what is the purpose?
set(v,'string','Order'); % what is the purpose?
0 Commenti
Risposta accettata
Star Strider
il 26 Gen 2019
The purpose appears to be to set the 'title' property of the legend object to be 'Order'.
At least that what appears when I run this code:
xx = -1:0.1:1;
yy = xx.^2;
figure;
plot(xx,yy,'LineWidth',2);
axis([-1 1 -0.2 1.2] )
h = legend(['f*';'10';'Ch']);
v = get(h,'title'); % what is the purpose?
set(v,'string','Order'); % what is the purpose?
See the documentation section on Add Title to Legend (link) for details. Creating legend titles this way is relatively recent.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Title 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!