| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
![]()
To graph selected variables, use the Plot Selector
in the Workspace Browser,
or use the Figure Palette Plot Catalog. Manipulate graphs in plot edit mode with the Property Editor. For details,
see Plotting Tools
— Interactive Plotting in the MATLAB Graphics
documentation and Creating Graphics
from the Workspace Browser in the MATLAB Desktop Tools
documentation.
waterfall(Z)
waterfall(X,Y,Z)
waterfall(...,C)
waterfall(axes_handles,...)
h = waterfall(...)
The waterfall function draws a mesh similar to the meshz function, but it does not generate lines from the columns of the matrices. This produces a "waterfall" effect.
waterfall(Z) creates a waterfall plot using x = 1:size(Z,1) and y = 1:size(Z,1). Z determines the color, so color is proportional to surface height.
waterfall(X,Y,Z) creates a waterfall plot using the values specified in X, Y, and Z. Z also determines the color, so color is proportional to the surface height. If X and Y are vectors, X corresponds to the columns of Z, and Y corresponds to the rows, where length(x) = n, length(y) = m, and [m,n] = size(Z). X and Y are vectors or matrices that define the x- and y-coordinates of the plot. Z is a matrix that defines the z-coordinates of the plot (i.e., height above a plane). If C is omitted, color is proportional to Z.
waterfall(...,C) uses scaled color values to obtain colors from the current colormap. Color scaling is determined by the range of C, which must be the same size as Z. MATLAB performs a linear transformation on C to obtain colors from the current colormap.
waterfall(axes_handles,...) plots into the axes with handle axes_handle instead of the current axes (gca).
h = waterfall(...) returns the handle of the patch graphics object used to draw the plot.
For column-oriented data analysis, use waterfall(Z') or waterfall(X',Y',Z').
Produce a waterfall plot of the peaks function.
[X,Y,Z] = peaks(30); waterfall(X,Y,Z)

The range of X, Y, and Z, or the current setting of the axes Llim, YLim, and ZLim properties, determines the range of the axes (also set by axis). The range of C, or the current setting of the axes CLim property, determines the color scaling (also set by caxis).
The CData property for the patch graphics objects specifies the color at every point along the edge of the patch, which determines the color of the lines.
The waterfall plot looks like a mesh surface; however, it is a patch graphics object. To create a surface plot similar to waterfall, use the meshz function and set the MeshStyle property of the surface to 'Row'. For a discussion of parametric surfaces and related color properties, see surf.
axes, axis, caxis, meshz, ribbon, surf
Properties for patch graphics objects
![]() | warning | wavfinfo | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |