Plot figure - get title
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
heidi pham
el 26 de En. de 2019
Respondida: Star Strider
el 26 de En. de 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 comentarios
Respuesta aceptada
Star Strider
el 26 de En. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Title en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!