stem — Create stem plots for discrete signals, sequence visualization, and MATLAB stem workflows.
stem creates vertical stems from a baseline up to each sample value, making it a standard choice for discrete signals and sequence visualization. In RunMat it returns a first-class plot handle, supports MATLAB-style shorthand and explicit x/y forms, and uses the shared marker path so marker semantics stay aligned with the rest of the plotting system.
How stem works in RunMat
stem(y)uses implicit x-values1:n, whilestem(x, y)uses explicit paired coordinates.- The returned value is a stem plot handle that works with
getandset. - Baseline visibility, markers, fill behavior, display names, and line styling all flow through the shared plotting property model.
- The plot remains subplot-local and composes naturally with legends and axes-local state.
- GPU-backed geometry is used when plotting-compatible buffers are available, with marker rendering sharing the point/marker pipeline.
How stem runs on the GPU
Stem line geometry can be emitted directly from GPU buffers on the happy path.
Markers use the shared rendering path, which keeps style semantics aligned with the rest of the plotting stack.
GPU memory and residency
stem preserves GPU residency when the direct stem packer path is available. Marker rendering stays on the shared marker path.
Examples
Create a stem plot from y-values only
stem([1 4 2 5 3]);Use explicit x-values and filled markers
x = 0:5;
h = stem(x, [0 1 0 2 0 3]);
set(h, 'Filled', true, 'DisplayName', 'samples');
legend;Inspect a stem handle after plotting
h = stem(1:5, [2 1 3 2 4]);
get(h, 'Type')Expected output:
ans =
'stem'Related functions to explore
These functions work well alongside stem. Each page has runnable examples you can try in the browser.
stairs, errorbar, legend, get, set
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how stem works, line by line, in Rust.
- View stem.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.