Skip to content

Instantly share code, notes, and snippets.

@chapter09
Created January 18, 2014 06:13
Show Gist options
  • Save chapter09/8486887 to your computer and use it in GitHub Desktop.
Save chapter09/8486887 to your computer and use it in GitHub Desktop.
this snippet is used for rotating x axis labels
XTickLabel = get(gca,'XTickLabel');
set(gca,'XTickLabel',' ');
hxLabel = get(gca,'XLabel');
set(hxLabel,'Units','data');
xLabelPosition = get(hxLabel,'Position');
y = xLabelPosition(2);
XTick = get(gca,'XTick');
y=repmat(y,length(XTick),1);
fs = get(gca,'fontsize');
hText = text(XTick, y, ... XTickLabel,'fontsize',fs);
set(hText,'Rotation',90,...
'HorizontalAlignment','right');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment