waterfall
Waterfall plot
Syntax
Description
waterfall(
creates a waterfall plot, which is a mesh plot with a partial curtain along the
y dimension. This results in a "waterfall" effect. The
function plots the values in matrix X
,Y
,Z
)Z
as heights above a grid
in the xy-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(___,
sets properties of the waterfall plot using one or more name-value arguments.
For example, you can specify the color and thickness of the plot edges. For a
list of properties, see Patch Properties. (since R2024b)Name=Value
)
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 theMeshStyle
property of the surface to'Row'
.
Algorithms
The
XLim
,YLim
, andZLim
properties of the axes store the limits for the x-, y-, and z-axis. These limits are based on the ranges of theX
,Y
, andZ
input arguments.The
CLim
property of the axes determines the distribution of colors across the range ofC
. For more information, see Control Colormap Limits.