Plot figure - get title
조회 수: 6 (최근 30일)
이전 댓글 표시
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
채택된 답변
Star Strider
2019년 1월 26일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!