File Exchange

image thumbnail

XTICKLABEL_ROTATE90

version 1.0 (2.01 KB) by

Rotate numeric Xtick labels by 90 degrees.

4.22222
9 Ratings

6 Downloads

Updated

View License

When the XTick labels are long numbers that overlap, making them hard to read or distinguish from one another, you may need to use XTICKLABEL_ROTATE90 in order to orient the tick labels vertically rather than horizontally.

Example 1: Set the positions of the XTicks and rotate them.

figure;
plot([1960:2004],randn(45,1));
xlim([1960 2004]);
xticklabel_rotate90([1960:2:2004]);
%Set "Property-value" pairs
xticklabel_rotate90([1960:2:2004],'Color','m');

Example 2: Rotate XTickLabels at their current position

XTick = get(gca,'XTick');
xticklabel_rotate90(XTick);

Comments and Ratings (9)

Celia Murcia

Thong

Thong (view profile)

Barry

Barry (view profile)

Diego Barragán

Diego Barragán (view profile)

Heiner Körnich

Works nicely with Matlab. Very useful extension. But I had problems to convert the ps-output from matlab to pdf.
So, if you want final pdf-output, I recommend using the routine xticklabel_rotate instead.

Can Ozan Tan

Great utility, one possible improvement to allow strings to be used as labels as well (current version allows only numeric labels):
-allow two input arguments in the preamble:
---XTick (tick positions - numeric - already there)
---XTickLabels (tick labels - could be either numeric or string - new arg)
-comment out line 42 :
xTickLabels = num2str(XTick);
And one glitch:
-When exported, 90 degrees rotated labels appear as if in italics, lower/higher degree rotations (e.g. 89/91) do not solve the issue.

A. El-Wakeel

You can also change the angle from 90 to 45 for example by changing it in the last row in the program.

Urs Schwarz (us)

very nice utility
a few improvements could include
- adjust fontsize to GCA's current fontsize
- add possibility to change other TEXT props

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video