View all functions

CategoryPlotting

What does stairs do?

stairs(x, y) draws a stairstep graph of the data in y versus the points in x, matching MATLAB's default styling. Each successive pair of points generates a horizontal segment followed by a vertical jump.

Behaviour highlights

  • Inputs must be real vectors of matching, non-zero length.
  • With single precision gpuArrays and the shared WebGPU renderer active, RunMat packs the vertex buffer directly on the GPU. Other data falls back to the CPU path automatically.
  • Like MATLAB, repeated calls append to the current axes when hold on is enabled.

Example

t = 0:5;
stairs(t, cumsum(rand(size(t))));