"text" handle, how do I grab all text and rotate it in a figure?
211 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!