title on legend 2014b

1 回表示 (過去 30 日間)
Esben
Esben 2014 年 10 月 21 日
コメント済み: Eyal Ben-Hur 2017 年 6 月 23 日
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 2017 年 6 月 23 日
Take a look here

サインインしてコメントする。

回答 (1 件)

Robert Cumming
Robert Cumming 2014 年 10 月 21 日
編集済み: Robert Cumming 2014 年 11 月 2 日
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 件のコメント
Image Analyst
Image Analyst 2014 年 11 月 1 日
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 2017 年 6 月 23 日
@Image Analyst, You may find a solution for that here

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by