{
"title": "stairs",
"category": "plotting",
"keywords": [
"stairs",
"step plot",
"stair plot",
"sampled signal",
"matlab stairs"
],
"summary": "Create step plots for sampled signals, piecewise-constant data, and MATLAB `stairs` workflows.",
"gpu_support": {
"elementwise": false,
"reduction": false,
"precisions": [
"single",
"double"
],
"broadcasting": "none",
"notes": "`stairs` can use a direct GPU-backed geometry path when plotting-compatible buffers are available."
},
"fusion": {
"elementwise": false,
"reduction": false,
"max_inputs": 2,
"constants": "inline"
},
"requires_feature": null,
"tested": {
"unit": "builtins::plotting::stairs::tests"
},
"description": "`stairs` creates staircase-style line plots for sampled or piecewise-constant data. In RunMat it returns a plot handle, supports MATLAB `stairs(y)` and `stairs(x, y)` style workflows, and reuses the shared line/marker property model so step plots behave consistently with the rest of the plotting stack.",
"behaviors": [
"`stairs(y)` uses implicit x-values `1:n`, while `stairs(x, y)` uses explicit paired coordinates.",
"The returned value is a plot handle that works with `get` and `set`.",
"Marker styling and display names can be updated through the same handle/property system used by line plots.",
"Step-plot rendering is subplot-local and respects current axes state just like `plot` and `scatter`.",
"GPU-backed geometry is preferred when exported buffers and the shared plotting device are available."
],
"examples": [
{
"description": "Plot a sampled staircase signal",
"input": "t = 0:5;\nstairs(t, cumsum([1 -1 2 -2 1 0]));"
},
{
"description": "Use MATLAB-style y-only shorthand",
"input": "stairs([3 1 4 1 5 9]);"
},
{
"description": "Style a stairs object and label it for the legend",
"input": "h = stairs(0:4, [1 2 2 3 5]);\nset(h, 'Color', 'm', 'LineWidth', 2, 'DisplayName', 'sampled signal');\nlegend;"
}
],
"links": [
{ "label": "plot", "url": "./plot" },
{ "label": "stem", "url": "./stem" },
{ "label": "scatter", "url": "./scatter" },
{ "label": "legend", "url": "./legend" },
{ "label": "set", "url": "./set" }
],
"source": {
"label": "`crates/runmat-runtime/src/builtins/plotting/ops/stairs.rs`",
"url": "https://github.com/runmat-org/runmat/blob/main/crates/runmat-runtime/src/builtins/plotting/ops/stairs.rs"
}
}