Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

xtickangle

Rotate x-axis tick labels

Syntax

xtickangle(angle)
xtickangle(ax,angle)
ang = xtickangle
ang = xtickangle(ax)

Description

example

xtickangle(angle) rotates the x-axis tick labels for the current axes to the specified angle in degrees, where 0 is horizontal. Specify a positive value for counterclockwise rotation or a negative value for clockwise rotation.

example

xtickangle(ax,angle) rotates the tick labels for the axes specified by ax instead of the current axes.

example

ang = xtickangle returns the rotation angle for the x-axis tick labels of the current axes as a scalar value in degrees. Positive values indicate counterclockwise rotation. Negative values indicate clockwise rotation.

ang = xtickangle(ax) uses the axes specified by ax instead of the current axes.

Examples

collapse all

Create a stem chart and rotate the x-axis tick labels so that they appear at a 45-degree angle from the horizontal plane.

x = linspace(0,10000,21);
y = x.^2;
stem(x,y)
xtickangle(45)

Create a figure with two subplots and return the axes objects as ax1 and ax2. Rotate the x-axis tick labels for the lower subplot by specifying ax2 as the first input argument to xtickangle.

ax1 = subplot(2,1,1);
plot(rand(6))

ax2 = subplot(2,1,2);
plot(rand(6))
xtickangle(ax2,45)

Create a stem chart. Then, query the rotation angle for the x-axis tick labels. By default, the labels are not rotated.

x = linspace(0,10000,21);
y = x.^2;
stem(x,y)

ang = xtickangle
ang = 0

Input Arguments

collapse all

Rotation of tick labels, specified as a scalar value in degrees, where 0 is horizontal.

Example: xtickangle(90)

Target axes, specified as a single Axes object or a vector of Axes objects. If you do not specify the axes, then xtickangle uses the current axes.

Algorithms

The xtickangle function sets and queries the XTickLabelRotation property of the Axes object.

Introduced in R2016b

Was this topic helpful?