# waterfall

Waterfall plot

## Syntax

## Description

`waterfall(`

creates a waterfall plot, which is a mesh plot with a partial curtain along the
`X`

,`Y`

,`Z`

)*y* dimension. This results in a "waterfall" effect. The
function plots the values in matrix `Z`

as heights above a grid
in the *x**y*-plane defined by
`X`

and `Y`

. The edge colors vary
according to the heights specified by `Z`

.

`waterfall(`

creates a waterfall
plot, and uses the column and row indices of the elements in
`Z`

)`Z`

as the *x*- and
*y*-coordinates.

`waterfall(`

plots
into the axes specified by `ax`

,___)`ax`

instead of the current axes.
Specify the axes as the first input argument. This argument can be used with any
of the previous input syntaxes.

`p = waterfall(___)`

returns the patch object.
Use `p`

to modify the waterfall plot after it is created. For a
list of properties, see Patch Properties.

## Examples

## Input Arguments

## Tips

To analyze the data as columns instead of rows, call

`waterfall`

with transposed arguments:[X,Y] = meshgrid(-3:.125:3); Z = peaks(X,Y); waterfall(X',Y',Z')

To create a mesh surface object instead of a patch object, use the

`meshz`

function. To create a plot similar to a waterfall plot, set the`MeshStyle`

property of the surface to`'Row'`

.

## Algorithms

The

`XLim`

,`YLim`

, and`ZLim`

properties of the axes store the limits for the*x*-,*y*-, and*z*-axis. These limits are based on the ranges of the`X`

,`Y`

, and`Z`

input arguments.The

`CLim`

property of the axes determines the distribution of colors across the range of`C`

. For more information, see Control Colormap Limits.

## Extended Capabilities

## Version History

**Introduced before R2006a**