フィルターのクリア

"text" handle, how do I grab all text and rotate it in a figure?

253 ビュー (過去 30 日間)
Michael
Michael 2013 年 6 月 13 日
Hi,
I've created a figure and annotated it using "text(x,y,'sample)" code, and I've got about 8 instances of it on my figure. I want to rotate all of these by 90 degrees since they're starting to overlap as I increase the axis ranges.
I'm hoping there's a way to grab the text object handles and then I think there's a text property that I can use 'rotate',90 to flip them all sideways.
SO the main question is, if I only wrote:
text(x,y,'sample')
rather than
text_handle = text(x,y,'sample)
does anyone know a way of grabbing the text object handles so that I can rotate them, without having to delete them and then re-do them? (I've lost their original positions).
Thanks.

採用された回答

Youssef  Khmou
Youssef Khmou 2013 年 6 月 13 日
Michael, The default rotation in text is 0°.
The text properties can be adjusted as the following example :
plot(randn(100,1));
h=text(1,1,' My description');
set(h,'Rotation',90);
  3 件のコメント
Youssef  Khmou
Youssef Khmou 2013 年 6 月 13 日
編集済み: Youssef Khmou 2013 年 6 月 13 日
hi, you have two ways :
1) use the data cursor in the 'tools' option in your figure to find the coordinates of the text written .
2)Use the findobj function to locate your text and then process it :
Here is an example :
plot(randn(10,4));
text(1,1,'Random variables');
% here i have no structure for the text, i locate it using :
H=findobj(gca,'Type','text');
set(H,'Rotation',60); % tilt
Michael
Michael 2013 年 6 月 13 日
This looks perfect, thank you very much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by