yticks — Query or set Y-axis tick values.

yticks returns or updates the tick mark locations for the Y axis of the current or specified axes.

Syntax

ticks = yticks()
ticks = yticks(ticks)
mode = yticks(mode)
ticks = yticks(ax, ticks)

Inputs

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

Returns

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

Errors

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

How yticks works

  • yticks() returns the current Y-axis tick values as a row vector.
  • yticks(ticks) sets manual Y-axis tick values. ticks must be an increasing numeric vector; [] removes Y-axis tick marks.
  • yticks('auto') returns the Y tick mode to automatic tick generation. yticks('manual') freezes the current tick values.
  • yticks('mode') returns 'auto' or 'manual'.
  • yticks(ax, ...) applies the same forms to the specified axes handle.
  • get(ax, 'YTick'), set(ax, 'YTick', ticks), get(ax, 'YTickMode'), and set(ax, 'YTickMode', mode) share the same axes metadata.

GPU memory and residency

yticks 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 Y-axis ticks

plot(-5:5, (-5:5).^2);
yticks([0 2 4 9 16 25]);

Expected output:

% Shows tick marks at the requested Y coordinates

Remove Y-axis tick marks

plot(1:10);
yticks([]);

Expected output:

% Hides Y-axis tick marks

Using yticks with coding agents

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

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