MATLAB Answers

title on legend 2014b

조회 수: 19(최근 30일)
Esben
Esben 21 Oct 2014
댓글: Eyal Ben-Hur 23 Jun 2017
Hi
I have read and now experienced that the legend of plots have been changed in the new version of MATLAB - 2014b. Now i have the problem that the 'title' property of a legend has been removed.
earlier i could use codes like:
h=legend(...)
v = get(h,'title');
set(v,'string','MY TEXT');
any easy way without using a simple text box?
Thanks, Esben

  댓글 수: 1

Eyal Ben-Hur
Eyal Ben-Hur 23 Jun 2017
Take a look here

로그인 to comment.

답변(1개)

Robert Cumming
Robert Cumming 21 Oct 2014
편집: Robert Cumming 2 Nov 2014
In the previous versions of Matlab legend was built on an axes.
Access to the title property of the legend wasn't (as far as I know) documented - hence it was there more by accidental design than intended design if you get what I mean.
The re-writing of legend means its no longer a by-product of an axes. By that fact I suspect this "feature" has also dissapeared.
Looking at the properties of legend, both documented and undocumented as far as I can tell there is no title to set.
edit: I have uploaded a submission to the FEX which you can use in both HG1 and HG2 to set titles on legends.

  댓글 수: 3

Sanjay
Sanjay 1 Nov 2014
I am having the same issue. What is now the recommended way of adding a title above the legend?
It seems like something almost everyone would need! Surely it's a common requirement?
Image Analyst
Image Analyst 1 Nov 2014
Can you get the 'Position' property of the legend box, then use text() to place some text atop it?
Eyal Ben-Hur
Eyal Ben-Hur 23 Jun 2017
@Image Analyst, You may find a solution for that here

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그

제품


Translated by