# How to Make a Waterfall Graph with Subgroups

### 1. Introduction

Typical waterfall plot has a single group which contains multiple line plots which are sequentially placed along Z axis (i.e., direction of the depth). You can see such examples in our Graph Gallery, for example at https://www.originlab.com/www/products/GraphGallery.aspx?GID=458.

However, if you want to arrange multiple plots at the same Z position, they must be organized by subgrouping. In the sample figure below, this waterfall has a single group with 2 subgroups (Z positions), and each subgroup has 6 plot lines as the subgroup members. By having subgroups, you can also control plot formats such as colors line styles, etc. within a subgroup (or between subgroups). This blog explain how you can make such waterfall with subgrouped plots.
(Note: This subgrouping feature is available in Origin 2016, or later versions.)

#### 2. Data Preparation

Of course, you have your data to be plotted, but the data should be organized to indicate the members of subgroups, and their labels. Here is a worksheet for the above sample. You notice the following points:

1) The worksheet has 2 user parameter rows (in this sample, Z Position and Z Label), corresponding to the 2 subgroups – IGMO-1 and IGMO-2. (To make a user parameter row, select any header row, right-click, and choose Add User Parameters flyout.) on it, and choose If you don’t need labeling for subgroups, but just specific positioning of subgrouped plots, you don’t need the Z Label row.  You can simply  put the subgroup number, 1,2,3,… if subgroups are equally spaced without the detail positioning.

2) In the Long Name row, each Y column has the label for each member plot. Since there are 2 subgroups, the same label sequence (5%, 10%,… ,30%) repeats twice. Legend can show these labels across the subgroups not redundantly. If you prefer, you can put these labels in a separate user parameter row.

#### 3. Procedure to Plot

Now, let us start to make a waterfall plot with subgroups.

1) Highlight all columns, and choose “Plot> 3D> Waterfall> 3D Waterfall” menu to make the initial waterfall plot. You notice that the graph has already organized with 2 subgroups – 6 plots are arranged at the same Z position. We can customize the graph to make nicely – especially the key is to color the plot lines according to the subgroup.  This is our next step.

2) Double-click the initial waterfall plot to show the Plot Details dialog. Choose the Group tab to define the subgrouping for the plot line colors as shown below. Here, first, let us tell what defines the subgroups at the bottom of the dialog – turn on the By Column Label radio button, and in our case select Z Position column label as this header row show the identification of our 2 subgroups (1.5 or 2.5).
For the line coloring, as we want to shift the line colors “within” the subgroup based on the selected color list, select “By One” for the Increment, and select “Within Subgroup” at the Subgroup.
Click OK button, and you get the graph like below.

Note 1:  If you choose “Between Subgroup” instead of “Within Subgroup“, colors shift along the Z positions within the group, not within the subgroup.
Note 2:  If you want to change the color list (default is “Q1 Basic”) of the plots in the subgroup, click on the current color list, and change it to other color scheme, or for the fine tuning of the color list, pressbutton at the right of the current color list, and you can change the specific color to another, change the order of the colors, or delete some specific colors from the list.

3) Let us put the subgroup labels in the Z Label header row (IGMO-1 and IMGO-2 in our sample).
To do so, first, double-click any axis tick label to open the Axis dialog box. As we want to put the subgroup labels at their “Major Tick” positions on Z axis, choose Scale tab in the dialog, choose Z axis at the left panel, and set Type under the Major Ticks to “By Plot Column Label” and Column Label to “Z Position” as this header row determines the Z position of the subgroups.
As we wanted to put the “Z Label” instead of the tick value at “Z Position”, go to Tick Labels tab, and choose Display subtab, then set the Type to “Column Name or Label”, and Display to “Z Label”.

4) We have already finished major customization of our waterfall graph with subgroups. If you like, you can do the further customization such as:

a) Reposition of the bottom (ZX) plane: In our sample, the bottom ZX plane was shifted upward to Y=0 position. You can do this in the “Plot Details” dialog, in the “Planes” tab at the “Layer1” level by setting the ZX plane to “At Position=0“. You may also want to check the “Grid Lines” check box here. To hide XY and YZ planes, change the color of these plabes to “None”, and turn OFF the “Enable” check box at “Plane Border”.
b) Thickness of the plot lines: In the “Plot Details” dialog, in the “Pattern” tab at the plot level, you can change the “Width” of the “Border”.
c) Z Axis Scale to position the subgroups: As our Z positions of subgroups in Z Position header row are 1.5 and 2.5. You can rescale the Z axis like from 1 to 3.
d) Legend from Long Name: If you make a new legend (“”Graph> Legend> Reconstruct Legend” menu), the legend labels come from Long Name header row automatically.  To change the swatch boxes in the legend to the line samples, in the “Plot Details” dialog, go to the “Pattern” tab, and change the “Color” of the “Fill” to “None“.
e) Projection method: If you like, you can change the 3D projection from “Perspective”(default) to “Orthographic” in the Miscellaneous tab at the “Layer1” level of the Plot Details dialog.

Now you get the waterfall graph with subgroups like the sample at top.

Acknowledgement:The sample data in this article was kindly provided by Dr. Edgar René López Mena, Departamento de Ciencias, Tecnológico de Monterrey, México, though the labels are arbitrary .