xlim
set or get x-axis limits.
📝Syntax
lims = xlim()
xlim([xmin, xmax])
xlim('auto')
xlim('manual')
m = xlim('mode')
xlim(ax, ...)
📥Input Arguments
Parameter Description
[xmin, xmax] x-coordinates: vector or matrix.
'auto' enable automatic limit selection.
'manual' freeze the x-axis limits at their current value.
'mode' returns the current x-axis limits mode.
ax a scalar graphics object value: parent container, specified as a axes.
📤Output Arguments
Parameter Description
lims two-element vector: [xmin, xmax]
m 'auto' or 'manual'.
📄Description

xlim get or set the limits of the x-axis for the current plot.

💡Examples
x = linspace(-1, 1);
y = sin(2*pi*x);
plot(x, y);
lim = xlim()
m = xlim('mode')
🔗See Also
axesaxis
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub