Plots > XY Plots > Plotting Data > Example: Creating Waterfall Plots
Example: Creating Waterfall Plots
Plot data that repeats a single parameter with slightly different values.
Two Dimensional Waterfall Plots
Pack all the dependent variable values into columns of a matrix, and the independent variable values into columns of another matrix. The 2D plot pairs the columns and creates multiple traces.
1. Define a waterfall data set.
2. Assign the rows number and the columns number to variables.
3. Define a vector as the second data set.
4. To provide an offset for each vector entry and each matrix entry, create a matrix from the vector.
Slightly offset the new matrix values to avoid overlapping traces.
5. Plot the two matrices.
Traces of Different Lengths
Display traces of unequal lengths by packing the empty entries in the array with NaNs.
1. 1. Add empty entries to the matrix.
2. Plot the new data.
The NaN entries are not displayed, leaving blanks in the line.
3D Waterfall Plots
1. Plot the matrices in a 3D plot. A waterfall plot in three dimensions appears.
Unlike for 2D plots, you can change the view of the plot by spinning, panning, or zooming in or out.