RunMat
GitHub

plot — Draw 2-D line plots that mirror MATLAB's plot(x, y) semantics.

plot(x, y) creates a 2-D line plot with MATLAB-compatible styling. Inputs may be real row/column vectors or single-precision gpuArray vectors when a shared WebGPU context is available.

How plot works in RunMat

  • Both x and y must contain the same number of elements; mismatched lengths raise errors.
  • Default styling mirrors MATLAB: blue solid line with circular markers disabled. Line width matches MATLAB's default (approx. 1 pt) but can be adjusted once the interactive window is open.
  • Multiple calls to plot append to the current figure when users call hold on (future work).
  • Single-precision gpuArray vectors stay on the device and feed a zero-copy line packer. Double-precision data or dashed/marker-heavy styles fall back to the CPU path automatically.

GPU memory and residency

plot terminates fusion graphs. If the inputs are single gpuArrays and the shared plotter device is active, their buffers are consumed zero-copy by the renderer. Otherwise the tensors are gathered before plotting, matching MATLAB semantics.

Example

plot(0:0.1:2*pi, sin(0:0.1:2*pi));
time = 0:0.1:2*pi;
amplitude = cos(time);
plot(time, amplitude)

These functions work well alongside plot. Each page has runnable examples you can try in the browser.

bar, contour, contourf, hist, mesh, meshc, scatter, scatter3, stairs, surf, surfc

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how plot 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 — free, no sign-up

Start running MATLAB code immediately in your browser.