Text location
281 ビュー (過去 30 日間)
古いコメントを表示
Is possible put a text in a determinated position, for example, at the top left?
0 件のコメント
採用された回答
Walter Roberson
2011 年 2 月 6 日
text(0,1,'Your String','Units','normalized')
3 件のコメント
Walter Roberson
2011 年 2 月 6 日
And the OP then talks about text() needing coordinates to locate the text within the figure, which is not something that text() ever did. We conclude that the OP was using the wrong terminology.
Walter Roberson
2018 年 10 月 5 日
h = annotation('textbox', [0 1 0 0], 'String', 'YourString', 'FitBoxToText', true);
その他の回答 (4 件)
Jan
2011 年 2 月 6 日
FigH = figure;
AxesH = axes('Parent', FigH, ...
'Units', 'normalized', ...
'Position', [0, 0, 1, 1], ...
'Visible', 'off', ...
'XLim', [0, 1], ...
'YLim', [0, 1], ...
'NextPlot', 'add');
TextH = text(0,1, 'Top left', ...
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'top');
Now you can inspect the properties with "get(TextH)" or "set(TextH)" for further adjustments.
Sometimes a UICONTROL('Style', 'text') is easier, because it does not need the invisible full-figure AXES object.
0 件のコメント
RonE
2018 年 10 月 4 日
I find the documentation on 'text' to be nearly useless in this matter. The following places text at the top left of the graph.
ylimits = ylim;
ymax = ylimits(2);
vert_spacing = ymax/47; %may have to experiment with this #
text(10, ymax-vert_spacing*1, 'Line 1');
text(10, ymax-vert_spacing*2, 'Line 2');
...
0 件のコメント
Jiro Doke
2011 年 2 月 6 日
What do you mean "top left"? Top left of the figure? Top left of the screen? Top left of the axes?
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!