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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
fmt | StringScalar | Yes | — | Numeric, date, or duration tick label format. |
ax | AxesHandle | Yes | — | Target axes handle or array of axes handles. |
Returns
| Name | Type | Description |
|---|---|---|
fmt | StringScalar | Current X-axis tick label format. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:xtickformat:InvalidArgument | Argument count, format value, or axes handle is invalid. | xtickformat: invalid argument |
RunMat:xtickformat:Internal | Internal 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 formatUsing 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.
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 · xticklabels · xticks · 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.