text to annotate figure

1 回表示 (過去 30 日間)
Richard
Richard 2012 年 2 月 29 日
コメント済み: Walter Roberson 2017 年 6 月 5 日
Is it possible to annotate a plot with text without having to specify the x and y coordinates. I know you can use commands like
'VerticalAlignment','top',...
'HorizontalAlignment','right');
after defining the x and y location but I'm producing many figures in a loop so the x and y values are always going to change so I would like something that would allow the text to always be displayed in the top right hand corner of the figure window. Is this possible?

採用された回答

Andrew Newell
Andrew Newell 2012 年 2 月 29 日
Sounds like you might want to use legend.
  2 件のコメント
Richard
Richard 2012 年 2 月 29 日
Is that to say that text can only be used with the x and y values. If so, legend works fine.
Andrew Newell
Andrew Newell 2012 年 2 月 29 日
If you want to label curves, then legend is a good approach.

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 2 月 29 日
No, for text() you still need to specify the x and y coordinates. You can, however, always use [1 1] to mean the upper right corner of of the figure, provided that 'Units' is 'normalized'.
  2 件のコメント
Morgan
Morgan 2017 年 6 月 5 日
If you use [1, 1] then the text will appear off the right-hand side of the plot. You would need [1-width,1]. The width is not known before creating the annotation.
Walter Roberson
Walter Roberson 2017 年 6 月 5 日
The text will not appear off the side of the plot if you use 'HorizontalAlignment','right'

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by