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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
option | StringScalar | Yes | — | Zoom option: on, off, toggle, xon, yon, reset, or out. |
factor | NumericScalar | Yes | — | Positive numeric zoom factor. |
target | Any | Yes | — | Figure or axes handle. |
option | Any | Yes | — | Zoom option or factor. |
fig | NumericScalar | Yes | — | Target figure handle. |
Returns
| Name | Type | Description |
|---|---|---|
z | Any | Zoom mode object for the current or specified figure. |
status | StringScalar | Returns "ok" when the zoom command succeeds. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:zoom:InvalidArgument | Argument count, target handle, factor, option, or zoom property is invalid. | zoom: invalid argument |
RunMat:zoom:Internal | Internal 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 2Use 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.
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 · xtickformat · xticklabels · xticks · yline · yscale · ytickangle · ytickformat · yticklabels · yticks
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.