stackplot

Stacked plot of 1D data.

Syntax
stackplot(x,y)
stackplot(x,y,scale)
stackplot(x,y,scale,step)
stackplot(x,y,scale,step,labels)
Description

This function plots 1D slices (columns or rows) of the matrix y stacked on top of each other, with the 1D array x as the x coorindate. The number of elements in x determines whether the columns or rows of y are plotted.

If scale is given, the data in the slices are rescaled to so that their values span a range of scale. If scale is not given, a value of 1 is assumed. If scale is set to zero, no rescaling is done, and the slices are taken as is.

The rescaled slices are then plotted with a separation of step between them. If step is not given, a value of 1 is assumed.

To condense slices, increase scale or/and decrease step. To space the slices further apart, decrease scale or/and increase step.

Examples

Here is a simple example of how to display five 1024-point data in a stacked plot.

x = 1:1024;
y = rand(5,1024);
stackplot(x,y);

To separate the traces more, you can use a small scaling factor

stackplot(x,y,0.2);

To label each trace separately, provide labels.

L = {'first','second','third','fourth','fifth'};
stackplot(x,y,0.2,1,L);
See also