
I have a 'text' object on my plot, how can I make it vertical or rotated at any other angle?
108 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2019 年 10 月 11 日
回答済み: MathWorks Support Team
2020 年 12 月 30 日
Consider the following MATLAB code to create a plot with a 'text' object:
x = 0:pi/20:2*pi;
y = sin(x);
plot(x,y)
text(pi,0,'\leftarrow sin(\pi)')
Is there some way to make the text 'vertical' or rotated at any other angle, instead of 'horizontal'?
採用された回答
MathWorks Support Team
2019 年 10 月 11 日
Yes, you can do this by modifying the 'Rotation' property of the text object's handle.
Please take a look at the following MATLAB code for an illustrative example:
x = 0:pi/20:2*pi;
y = sin(x);
plot(x,y);
% create some text objects on the plot and get there 'handles'
t = text(pi,0,'\leftarrow sin(\pi)');
t1 = text(1,0,'text1');
t2 = text(2,0,'text2');
t3 = text(5,0,'text3');
% Specify rotation angles for the 'text' object handles
t.Rotation = 90;
t1.Rotation = 30;
t2.Rotation = 180;
t3.Rotation = 45;

0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Labels and Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!