xtickformat — Query or set the X-axis tick label format for the current axes, a specified axes handle, or an axes array.

xtickformat controls automatic X-axis tick label formatting. It supports query, numeric format assignment, MATLAB shorthand formats such as usd and percentage, custom printf-style numeric formats, date/duration format strings for compatibility, scalar axes query forms, and axes-array setter forms.

Syntax

fmt = xtickformat()
xtickformat(fmt)
fmt = xtickformat(ax)
xtickformat(ax, fmt)

Inputs

NameTypeRequiredDefaultDescription
fmtStringScalarYesNumeric, date, or duration tick label format.
axAxesHandleYesTarget axes handle or array of axes handles.

Returns

NameTypeDescription
fmtStringScalarCurrent X-axis tick label format.

Errors

IdentifierWhenMessage
RunMat:xtickformat:InvalidArgumentArgument count, format value, or axes handle is invalid.xtickformat: invalid argument
RunMat:xtickformat:InternalInternal plotting state update fails.xtickformat: internal operation failed

GPU memory and residency

xtickformat only reads and writes axes metadata. It does not inspect, gather, or transform GPU-resident plot data; formatted labels are generated from tick metadata at render/query time.

Examples

Show X-axis tick labels with units

plot(1:3, [10 20 30]);
xticks([1 2 3]);
xtickformat('%.1f s');
xticklabels()

Expected output:

{'1.0 s', '2.0 s', '3.0 s'}

Apply a format to a specific subplot

ax1 = subplot(1, 2, 1);
plot(ax1, 1:3);
ax2 = subplot(1, 2, 2);
plot(ax2, 10:10:30);
xtickformat(ax2, 'usd');

Expected output:

% Only ax2 receives the dollar tick-label format

Using xtickformat with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how xtickformat changes the result.

Run a small xtickformat 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.