RunMat
GitHub

hold — Control whether new plots replace or append to the current axes.

hold controls whether subsequent plotting commands append to the current axes or replace existing plot objects. The state is tracked per axes, so different subplots can have different hold settings.

How hold works

  • hold() toggles the current hold state.
  • hold('on') enables appending to the current axes.
  • hold('off') disables appending so later plots replace the axes contents.
  • hold('all') is currently treated the same as hold('on').
  • Logical and numeric scalar inputs are accepted: zero means off and nonzero means on.

How RunMat runs hold on the GPU

hold performs no provider dispatch; it updates per-axes plotting state in the host-side registry.

GPU memory and residency

hold only mutates plotting state and does not affect array residency.

Examples

Append a second line to the same axes

x = 0:0.1:1;
plot(x, x);
hold on;
plot(x, x.^2);

Expected output:

% both lines remain visible on the current axes

Disable appending again

hold off;
plot(1:5, [5 4 3 2 1]);

Expected output:

% the new plot replaces the previous axes contents

Toggle hold state programmatically

state1 = hold();
state2 = hold();

Expected output:

% state1 and state2 reflect the toggled boolean state

FAQ

Is hold state per figure or per axes?

It is tracked per axes, so one subplot can be in hold mode while another is not.

What does hold('all') do?

RunMat currently treats 'all' the same as 'on'.

What does the return value mean?

It is the resulting boolean hold state after applying the command.

2D Charts

area · bar · errorbar · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem

3D & Surface

contour · contourf · mesh · meshc · plot3 · quiver · scatter3 · surf · surfc

Images

image · imagesc

Axes & Layout

axis · box · grid · sgtitle · subplot · view · zlabel

Appearance

colorbar · colormap · legend · shading

Handle Access

get · set

Other

cla · clf · figure · gca · gcf · imshow · title

Open-source implementation

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

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.

  • Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
  • Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
  • A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.

Getting started · Benchmarks · Pricing

Try RunMat for free

Open the sandbox and start running MATLAB code in seconds. No account required.