yticklabels — Query or set Y-axis tick labels for the current axes or a specified axes handle.

yticklabels controls the display text associated with Y-axis tick marks. It supports query, explicit label assignment, automatic mode, manual mode, mode query, and explicit axes-target forms.

Syntax

labels = yticklabels()
labels = yticklabels(labels)
mode = yticklabels(mode)
labels = yticklabels(ax, labels)

Inputs

NameTypeRequiredDefaultDescription
labelsAnyYesString array or cell array of character vectors for Y-axis tick labels.
modeStringScalarYesTick label mode string: 'auto', 'manual', or 'mode'.
axAxesHandleYesTarget axes handle.

Returns

NameTypeDescription
labelsAnyCurrent Y-axis tick labels as a cell array of character vectors.
modeStringScalarCurrent Y-axis tick label mode, 'auto' or 'manual'.

Errors

IdentifierWhenMessage
RunMat:yticklabels:InvalidArgumentArgument count, tick label values, mode, or axes handle is invalid.yticklabels: invalid argument
RunMat:yticklabels:InternalInternal plotting state update fails.yticklabels: internal operation failed

GPU memory and residency

yticklabels only reads and writes axes metadata. It does not gather GPU-resident plot data; automatic labels are generated from current tick metadata and cached display bounds.

Examples

Set Y-axis tick values and labels

plot(0:10, (0:10).^2);
yticks([0 50 100]);
yticklabels({'low', 'mid', 'high'});

Expected output:

% The Y-axis shows the three supplied labels

Query and reset label mode

yticklabels({'A', 'B'});
yticklabels('mode')
yticklabels('auto');

Expected output:

ans = 'manual'
% Labels return to automatic numeric formatting

Set labels on a specific axes

ax = subplot(1, 2, 2);
plot(ax, 1:3);
yticks(ax, [1 2 3]);
yticklabels(ax, {'one', 'two', 'three'});

Expected output:

% Only the target axes receives the labels

Using yticklabels with coding agents

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

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