How to fix a text's location on a plot, without giving text's axises?

1 回表示 (過去 30 日間)
smo
smo 2016 年 9 月 17 日
コメント済み: smo 2016 年 9 月 17 日
I would like to add a text on my plots. I am using the text(x,y,textword) function to do so. But I have a problem about fixing them at the corner of my plot. Because I have 20sets of data that I need to plot, each of them has slightly different x&y scales. Thus I cannot give a 'certain' x and y location to my textwords. If there a way I can tell MATLAB to display the text on the top right corner of each of plot, without per-define the text's location?
thanks.

採用された回答

Image Analyst
Image Analyst 2016 年 9 月 17 日
You can get xlim and ylim, then set x and y accordingly.
xl = xlim();
yl = ylim();
xWidth = xl(2)-xl(1);
yHeight = yl(2)-yl(1);
% Set x 90% of the way over.
x = xl(1) + 0.90 * xWidth;
% Set y 5% of the way up from the bottom.
y = yl(1) + 0.05 * yHeight;
text(x, y, 'Here I am!');

その他の回答 (0 件)

カテゴリ

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