<b>NB: As of R2014b this functionality is built into MATLAB axes using the 'XTickLabelRotation' property.</b>
This function rotates the x-tick labels on a plot. An arbitrary angle can be specified for the text and the label justification adjusts appropriately to ensure the labels lie below the ticks. The axes font properties are preserved in the labels, which will update in response to font changes. Changes to the axes limits are also handled.
* Arbitrary angle of rotation
* Justification adjusts appropriately for the specified angle
* Axes font property changes are reflected
* Labels move correctly when zooming and panning
As with other functions that achieve the same result, this works by replacing the xtick labels with text objects. Handles to the created text objects are returned for you to tinker with.
Ben Tordoff (2021). rotateXLabels( ax, angle, varargin ) (https://www.mathworks.com/matlabcentral/fileexchange/27812-rotatexlabels-ax-angle-varargin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: Rotate XTick Labels for multi-axes
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!