How can I rotate my x axes made by words?

2 ビュー (過去 30 日間)
simo boni
simo boni 2015 年 8 月 1 日
回答済み: simo boni 2015 年 8 月 1 日
Hi all,
I am trying to plot a 2D graph with the x-axes made with a string (words).
I would like to rotate the words of 45 degree.
here is my code
%
figure(1)
f1=plot(f,x1,'-sk','LineWidth', 1.5);
hold on
f2=plot(f,x2,'-sm','LineWidth', 1.5);
hold on
f3=plot(f,x3,'-d','LineWidth', 1.5);
hold on
f4=plot(f,x4,'-^g','LineWidth', 1.5);
hold on
grid on
set(gca, 'XTick',1:5, 'XTickLabel',{'Healthy' 'Unbalance' 'Misalignment' 'Looseness' 'Rub'}) % these are the words to rotate
xlabel('Measurement set','fontweight','bold','fontsize',14);
ylabel('Amplitude','fontweight','bold','fontsize',14)
title('Bearing 1 40Hz CF','fontweight','bold','fontsize',16)
legend('Bearing 1','Bearing 2','Bearing 3','Bearing 4')
%
Thanks in advance

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 8 月 1 日
編集済み: Azzi Abdelmalek 2015 年 8 月 1 日
If you are using version of Matlab after 2014b
set(gca,'xticklabelrotation',45)
If you haven't the latest version of Matlab, you can find it in File exchange http://www.mathworks.com/matlabcentral/fileexchange/27812-rotatexlabels--ax--angle--varargin--

その他の回答 (1 件)

simo boni
simo boni 2015 年 8 月 1 日
Thanks Azzi

カテゴリ

Help Center および File Exchange3-D Scene Control についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by