MATLAB Function Reference Previous page   Next Page
stairs

Stairstep graph

Syntax

Description

Stairstep graphs are useful for drawing time-history graphs of digitally sampled data.

stairs(Y) draws a stairstep graph of the elements of Y, drawing one line per column for matrices. The axes ColorOrder property determines the color of the lines.

When Y is a vector, the x-axis scale ranges from 1 to length(Y). When Y is a matrix, the x-axis scale ranges from 1 to the number of rows in Y.

stairs(X,Y) plots the elements in Y at the locations specified in X. The elements of X must be monotonic.

X must be the same size as Y or, if Y is a matrix, X can be a row or a column vector such that

stairs(...,LineSpec) specifies a line style, marker symbol, and color for the graph (see LineSpec for more information).

stairs(...,'PropertyName',propertyvalue) creates the stairstep graph, applying the specified property settings. See Stairseries Properties for a description of properties.

stairs(axes_handles,...) plots into the axes with handle axes_handle instead of the current axes object (gca).

h = stairs(...) returns the handles of the stairseries objects created (one per matrix column).

[xb,yb] = stairs(Y,...) does not draw graphs, but returns vectors xb and yb such that plot(xb,yb) plots the stairstep graph.

Backward Compatible Version

hlines = stairs('v6',...) returns the handles of line objects instead of stairseries objects for compatibility with MATLAB 6.5 and earlier.

Examples

Create a stairstep plot of a sine wave.

See Also

bar, hist, stem

Discrete Data Plots for related functions

See Stairseries Properties for property descriptions


Previous page  sscanf Stairseries Properties Next page

© 1994-2005 The MathWorks, Inc.