"text" handle, how do I grab all text and rotate it in a figure?
조회 수: 213 (최근 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!