Question

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)
Was it helpful?

Solution

You can use this Rotating X axis Labels

Example:

rotateXLabels( xlabel, 45 )

OTHER TIPS

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)

Starting from R2016b you can do:

xtickangle(angle)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top