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

NameTypeRequiredDefaultDescription
ticksNumericArrayYesIncreasing numeric vector of X-axis tick values; [] removes tick marks.
modeStringScalarYesTick mode string: 'auto', 'manual', or 'mode'.
axAxesHandleYesTarget axes handle.
ticksNumericArrayYesIncreasing numeric vector of X-axis tick values.

Returns

NameTypeDescription
ticksNumericArrayCurrent X-axis tick values.
modeStringScalarCurrent X-axis tick mode, 'auto' or 'manual'.

Errors

IdentifierWhenMessage
RunMat:xticks:InvalidArgumentArgument count, tick vector, mode, or axes handle is invalid.xticks: invalid argument
RunMat:xticks:InternalInternal 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. ticks must 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'), and set(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 coordinates

Reset X-axis ticks to automatic mode

xticks([0 5 10]);
xticks('auto');

Expected output:

% Restores automatic X tick generation

Using 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.

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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.