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.
Click to copy this expression
2. Assign the rows number and the columns number to variables.
Click to copy this expression
Click to copy this expression
3. Define a vector as the second data set.
Click to copy this expression
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.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
5. Plot the two matrices.
Click to copy this expression
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.
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Plot the new data.
Click to copy this expression
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.
Click to copy this expression
Unlike for 2D plots, you can change the view of the plot by spinning, panning, or zooming in or out.