scatter — Render MATLAB-compatible 2-D scatter plots.
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.
How scatter works in RunMat
- 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).
GPU memory and 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.
Example
t = linspace(0, 2*pi, 100);
scatter(cos(t), sin(t))Related functions to explore
These functions work well alongside scatter. Each page has runnable examples you can try in the browser.
bar, contour, contourf, hist, mesh, meshc, plot, scatter3, stairs, surf, surfc
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how scatter works, line by line, in Rust.
- View scatter.rs on GitHub
- Learn how the runtime works
- Found a bug? Open an issue with a minimal reproduction.
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.