xticks — Query or set X-axis tick values.
xticks returns or updates the tick mark locations for the X axis of the current or specified axes.
Syntax
ticks = xticks()
ticks = xticks(ticks)
mode = xticks(mode)
ticks = xticks(ax, ticks)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
ticks | NumericArray | Yes | — | Increasing numeric vector of X-axis tick values; [] removes tick marks. |
mode | StringScalar | Yes | — | Tick mode string: 'auto', 'manual', or 'mode'. |
ax | AxesHandle | Yes | — | Target axes handle. |
ticks | NumericArray | Yes | — | Increasing numeric vector of X-axis tick values. |
Returns
| Name | Type | Description |
|---|---|---|
ticks | NumericArray | Current X-axis tick values. |
mode | StringScalar | Current X-axis tick mode, 'auto' or 'manual'. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:xticks:InvalidArgument | Argument count, tick vector, mode, or axes handle is invalid. | xticks: invalid argument |
RunMat:xticks:Internal | Internal plotting state update fails. | xticks: internal operation failed |
How xticks works
xticks()returns the current X-axis tick values as a row vector.xticks(ticks)sets manual X-axis tick values.ticksmust be an increasing numeric vector;[]removes X-axis tick marks.xticks('auto')returns the X tick mode to automatic tick generation.xticks('manual')freezes the current tick values.xticks('mode')returns'auto'or'manual'.xticks(ax, ...)applies the same forms to the specified axes handle.get(ax, 'XTick'),set(ax, 'XTick', ticks),get(ax, 'XTickMode'), andset(ax, 'XTickMode', mode)share the same axes metadata.
GPU memory and residency
xticks only reads and writes axes metadata. It does not gather GPU-resident plot data; automatic ticks are generated from the axes display bounds, including explicit limits and cached plotted-data bounds.
Examples
Set nonuniform X-axis ticks
plot(-5:5, (-5:5).^2);
xticks([-5 -2.5 0 1 2.5 5]);Expected output:
% Shows tick marks at the requested X coordinatesReset X-axis ticks to automatic mode
xticks([0 5 10]);
xticks('auto');Expected output:
% Restores automatic X tick generationUsing xticks with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how xticks changes the result.
Run a small xticks example, explain the result, then change one input and compare the output.
Related Plotting functions
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
Other
addpoints · ancestor · animatedline · axes · barh · cla · clf · colorcube · colororder · copyobj · daspect · datacursormode · dataTipTextRow · fcontour · figure · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · parula · patch · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · textscatter · textscatter3 · triplot · waitbar · wordcloud · xline · xscale · xtickangle · xtickformat · xticklabels · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zoom
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.