RunMat
GitHub

View all functions

CategoryPlotting

What does plot do?

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.

Behaviour highlights

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

Examples

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

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