RunMat
GitHub

View all functions

CategoryPlotting

What does scatter do?

scatter(x, y) plots paired points in 2-D space. The RunMat implementation mirrors MATLAB's default styling—circular markers, grid enabled, and axis labels applied to the active figure. Positional size/color arguments (S, C), the 'filled' flag, and name-value pairs for marker appearance are supported.

Behaviour highlights

  • Inputs must contain the same number of elements. Row and column vectors are both accepted.
  • Single-precision gpuArray inputs stay on the device when the shared WebGPU renderer is active, so browser and native builds avoid a gather step. Other tensors automatically fall back to the host path.
  • Positional size/color inputs plus 'Marker*' name-value pairs match MATLAB semantics. Per-point size/color vectors currently force the CPU path until the scatter GPU shaders consume those attributes directly (tracked separately).

Examples

t = linspace(0, 2*pi, 100);
scatter(cos(t), sin(t));

GPU residency

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