xticks
Set or get x-axis tick values.
📝Syntax
ticks = xticks()
xticks(values)
xticks('auto')
xticks('manual')
m = xticks('mode')
xticks(ax, ...)
📥Input Arguments
Parameter Description
values Numeric vector of x-axis tick values.
'auto' Enable automatic x-tick selection.
'manual' Freeze the current x-tick values.
'mode' Return the x-tick mode.
ax Target axes. Default is the current axes.
📤Output Arguments
Parameter Description
ticks Numeric row vector of x-axis tick values.
m 'auto' or 'manual'.
📄Description

xticks gets or sets the tick values along the x-axis of the current axes.

Specifying tick values switches the x-tick mode to manual.

💡Examples
Set x-axis ticks.
x = linspace(0, 10, 50);
plot(x, sin(x));
xticks(0:2:10);
ticks = xticks()
🔗See Also
xticklabelsxtickanglexlim
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub