如何让横坐标倾斜(Matlab画直方图)

直接上代码及效果图 :

clc;clear;
								
Method{1}='First';
Method{2}='Second';
Method{3}='Third';
Method{4}='Fourth';
Method{5}='Fifth';
Method{6}='Sixth';

Ordinate_1=[0.3212;0.3532;0.2145;0.5564;0.3423;0.1224];
Ordinate_2=[0.4353;0.6564;0.5212;0.5232;0.7544;0.5223];
Ordinate_3=[0.6433;0.5322;0.3212;0.3221;0.3453;0.42323];
Ordinate_4=[0.1452;0.3123;0.1111;0.1234;0.6343;0.3522];


X=[1;2;3;4;5;6];
Y1=[Ordinate_1, Ordinate_2, Ordinate_3, Ordinate_4];


figure; bar(X,Y1); 
% xlabel('Method');
ylabel('Ordinate'); 
legend('AL','BM','CS','PR');
axis([0 8 0 0.8]); grid on;
set(gca,'xticklabel',{Method{1},Method{2},Method{3},Method{4},Method{5},Method{6}})
xtb = get(gca,'XTickLabel');% 获取横坐标轴标签句柄
xt = get(gca,'XTick');% 获取横坐标轴刻度句柄
yt = get(gca,'YTick'); % 获取纵坐标轴刻度句柄         
xtextp=xt;%每个标签放置位置的横坐标,这个自然应该和原来的一样了。                    
ytextp=-0.1*yt(3)*ones(1,length(xt));
text(xtextp,ytextp,xtb,'HorizontalAlignment','right','rotation',26,'fontsize',10);
set(gca,'xticklabel','');% 将原有的标签隐去

ytextp=-0.1*yt(3)*ones(1,length(xt));
text(xtextp,ytextp,xtb,'HorizontalAlignment','right','rotation',26,'fontsize',10);
set(gca,'xticklabel','');% 将原有的标签隐去

效果图: 

如何让横坐标倾斜(Matlab画直方图) 

 去除网格(将上述代码中的  grid on 注释即可):

如何让横坐标倾斜(Matlab画直方图)