
I have a 'text' object on my plot, how can I make it vertical or rotated at any other angle?
111 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 11 Okt. 2019
Beantwortet: MathWorks Support Team
am 30 Dez. 2020
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'?
Akzeptierte Antwort
MathWorks Support Team
am 11 Okt. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!