Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB rotate xtick labels

I cannot figure out how to rotate my xtick labels in a 3d graph. Someone previously suggested:

set(get(gca,'xlabel'), 'Rotation',90)

But when I do this, nothing changes.

The whole code is:

width = 0.7
zheight = 500
set(0,'DefaultAxesLineStyleOrder',{'-*',':','o'})

d=bar3(a,x,width)
set(gcf,'color','w');
zlim([0 zheight])

set(gca,'FontSize',14 ,'FontWeight','bold')
set(gca, 'YTick',1:8, 'YTickLabel',{'1','2','4','8','12','16','20','24'})
set(gca, 'XTick',1:7, 'XTickLabel',{'a' 'b' c' 'd' 'e','f','g'})
set(get(gca,'xlabel'),'rotation',90)
like image 786
Ben Avatar asked Jul 30 '14 20:07

Ben


1 Answers

As of matlab version R2014b, this is built into matlab. (As noted in the rotateXLabels package from the answer by @lakesh)

You can rotate the labels:

set(gca, 'XTickLabelRotation', 90)
like image 51
mjeppesen Avatar answered Oct 04 '22 01:10

mjeppesen