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

NameTypeRequiredDefaultDescription
targetNumericScalarNoExisting axes handle to make current, or figure handle to parent new axes.
propertiesPropertyNameVariadicAxes property/value pairs. The construction-time Parent property may target a figure.

Returns

NameTypeDescription
axNumericScalarAxes handle.

Errors

IdentifierWhenMessage
RunMat:axes:InvalidArgumentUnsupported handle or property/value arguments are provided.axes: invalid argument
RunMat:axes:InternalInternal 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.
  • Position and Units round-trip through get, set, and dot-property access. Explicit Position values 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 handle

Create 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.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how axes is executed, line by line, in Rust.

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.