axes — Create axes or make an existing axes current.
axes creates a new axes in the current figure, creates axes in a target figure, or selects an existing axes handle as current. Property/value pairs are applied during construction or selection.
Syntax
ax = axes()
ax = axes(target)
ax = axes(property, value, ...)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
target | NumericScalar | No | — | Existing axes handle to make current, or figure handle to parent new axes. |
properties | PropertyName | Variadic | — | Axes property/value pairs. The construction-time Parent property may target a figure. |
Returns
| Name | Type | Description |
|---|---|---|
ax | NumericScalar | Axes handle. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:axes:InvalidArgument | Unsupported handle or property/value arguments are provided. | axes: invalid argument |
RunMat:axes:Internal | Internal axes state operation fails. | axes: internal operation failed |
How axes works
axes()creates a new axes in the current figure and returns its numeric axes handle.axes(fig)creates a new axes parented to the specified figure handle.axes(ax)makes an existing axes handle current.axes('Parent', fig, ...)creates axes in the requested figure and applies the remaining axes properties.axes(ax, property, value, ...)selects an existing axes and applies the supplied properties.PositionandUnitsround-trip throughget,set, and dot-property access. ExplicitPositionvalues participate in renderer viewport layout without disabling per-axes fast paths.
Does RunMat run axes on the GPU?
axes performs no provider dispatch; it updates plotting registry state and renderer axes metadata.
GPU memory and residency
axes returns host-side handles and does not change array GPU residency.
Examples
Create positioned axes
ax = axes('Position', [0.2 0.2 0.6 0.6]);
plot(ax, 1:10);Expected output:
% ax is a numeric axes handleCreate axes in a specific figure
f = figure(3);
ax = axes('Parent', f, 'Units', 'pixels', 'Position', [40 40 320 220]);Select an existing axes
ax1 = axes();
ax2 = axes();
axes(ax1);Using axes with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how axes changes the result.
Run a small axes example, explain the result, then change one input and compare the output.
FAQ
Does axes replace gca?⌄
No. Use axes when creating or selecting axes. Use gca when reading the current axes handle.
Does an explicit axes Position force a slow renderer path?⌄
No. Positioned axes are converted into the same per-axes viewport rectangles used by subplot rendering, preserving direct viewport mapping where it is otherwise applicable.
Does axes run numeric kernels?⌄
No. It mutates plotting state only.
Related Plotting functions
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
Other
addpoints · ancestor · animatedline · 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 · zoom
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how axes is executed, line by line, in Rust.
- View the source for axes in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
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.