zoom — Control zoom mode and programmatic axes zooming for figures and axes.

zoom toggles figure zoom mode, applies positive numeric zoom factors to axes limits, records and restores zoom baselines, and returns a MATLAB-compatible zoom handle object for get/set workflows.

Syntax

z = zoom()
zoom()
status = zoom(option)
status = zoom(factor)
status = zoom(target, option)
z = zoom(fig)

Inputs

NameTypeRequiredDefaultDescription
optionStringScalarYesZoom option: on, off, toggle, xon, yon, reset, or out.
factorNumericScalarYesPositive numeric zoom factor.
targetAnyYesFigure or axes handle.
optionAnyYesZoom option or factor.
figNumericScalarYesTarget figure handle.

Returns

NameTypeDescription
zAnyZoom mode object for the current or specified figure.
statusStringScalarReturns "ok" when the zoom command succeeds.

Errors

IdentifierWhenMessage
RunMat:zoom:InvalidArgumentArgument count, target handle, factor, option, or zoom property is invalid.zoom: invalid argument
RunMat:zoom:InternalInternal zoom state or handle-object update fails.zoom: internal operation failed

GPU memory and residency

zoom mutates plotting metadata only. Numeric zoom factors update stored axes limits directly and do not gather or copy GPU-resident plot data.

Examples

Zoom in around the current axes center

plot(1:10, rand(1, 10));
zoom(2);

Expected output:

% Current axes limits shrink by a factor of 2

Use the zoom object with get and set

z = zoom;
set(z, 'Enable', 'on', 'Motion', 'horizontal');
get(z, 'Motion')

Expected output:

ans = 'horizontal'

Using zoom with coding agents

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

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