6.10.6 Two-Level Grouped Box Chart
Origin’s box chart is advanced and customizable, this tutorials shows how to create a two- level grouped box chart from indexed data in Origin.
Minimum Origin Version Required: 2015 SR0
What you will learn
This tutorial will demonstrate how to:
- Use the data filter to select worksheet data.
- Stack column for box chart.
- Controlling the categorical values.
- Create a grouped box chart from indexed data.
- Customize box chart settings.
- Customize the axis dialog for box charts.
- Add a graph into box chart.
This tutorial is associated with <Origin EXE Folder>\Samples\Tutorial Data.opj, so you should open Tutorial Data.opj and browse to the folder Two-Level Grouped Box Chart at first.
Using data filter to select worksheet data
In the following steps, you can select the data you want to analyze by data filter:
- Active the worksheet US Mean Temperature and then highlight Column B.
- Click the Add/Remove Data Filter button on the Worksheet Data toolbar to add empty data filter to Column B.
- Click the Filter icon on the column header of Column B, clear the check boxes before Select All, and check CA, FL and TX again.
- Click OK to apply the filter.
Stacking columns to convert data into index mode
In the following steps, you can convert data from the raw mode into index mode:
- Highlight Column E to Column P (from January to December), and then select Worksheet: Stack Columns from the main menu to open the Stack Columns dialog
- Check the box before Include Other Column(s), click the Select from Worksheet button, and select Column A and B in the worksheet.
- Change the Group Column Long Name to “Month” and Data Column Long Name to “Temperature”
- Click OK to launch the new worksheet StackCols1
- Click the Lock icon on the column header, and select Recalculate Mode: None in the context menu.
Controlling the categorical values
In the following steps, you can customize the order of values shown in the graph but not change the source data:
- Highlight Column B in Worksheet StackCols1, and then right click to select Set as Categorical.
- Double click the Categories cell “unsorted” of Column B to open the Categories dialog.
- Uncheck the <auto> checkbox, and then specify the order of items into: CA-TX- FL by using Move to Top button, Move up button, Move Down button and Move to Bottom button.
- Redo step2 and step3 in Column C to specify the order of items into: January to December.
Create a grouped box chart from indexed data
- Highlight Column D in Worksheet StackCols1, and then select Plot > Categorical : Grouped Box Chart – Indexed Data… in the main menu.
- In the open dialog Plotting: gboxindexed, click the triangle button at the top right corner in Groupe Column(s) section, and then select C(Y): Month and B(Y): State in order in the context menu item.
- Click OK to create a grouped box chart with two levels.
Customize box chart settings
- Select the graph layer (click somewhere in the lower-middle portion of the layer seems to work best ), and then drag the control handle to resize it as you want (put the cursor on the control handle, and drag it when the cursor becomes a two-headed arrow).
- Select Graph:Fit Page to Layers in the main menu to open the dialog, and then select Height Only in the drop-down list of Adjust Direction to match the page width to that of the bounding box.
The graph will look like as below:
- Double click on any one of the boxes to open Plot Details dialog, go to Group tab. For both Border Color and Boxed Color, set Increment to By One and Subgroup to With Subgroup, so each subgroup has a different color. Click the color scale on the Details section, and select S01 Gray Scale in the drop down list for both Border Color and Boxed Color.
- Go to Pattern tab, uncheck the checkbox Follow the line transparency and set transparency to 30%.
- Go to Spacing tab to set the gap value between and within subgroup.
- Go to Box tab to set the range of box and whisker.
- Go to Percentile tab, clear the check box before the 99%, 1%, Max and Min, and then select the shape and size of Mean marker.
- Go to Line tab to customize the caps of whisker and uncheck the Median checkbox.
- Click OK button to apply the setting.
- Right-click the legend, and select Legend: Box Chart Components... in the context menu. In the ' Enhanced Box Legend: legendbox dialog, select State in the Box Indentifier dropdown list.
The graph will look like as below:
Customize the axis dialog for box charts
- For the X Axis, change as the following steps:
- Double click X Axis to open the Axis Dialog, and then select Bottom1 on the left panel
- Go to Tick Labels tab, set the font size of Bottom1 with 14 in Format tab, and duplicate settings as shown below in Table tab.
- Select Bottom2 on the left panel, uncheck the <Auto> checkbox and set the font size of Bottom2 with 11 in Format tab, and duplicate settings as shown below in Table tab.
The elements of table layout are shown as below:
- Go to Line and Tick tab, and change the style of major ticks into In.
- For the Y Axis, change scale, title, font size of label tick and the style of ticks as shown below:
- Hide the top and right axis of the plot:
Press CTRL and select both Top and Right in the left panel, and then go to Line and Ticks tab to uncheck Show Line and Ticks.
- Click OK to apply your setting.
- Select Legend and press Delete to remove it, the graph should appear as below
Add a graphical symbol of the box into box chart
If you want to add a graphical symbol of to tell the meaning of each line in box, you can follow these steps:
- Active Workbook US Mean Temperature, right click the label of worksheet below and select Add to add a new worksheet into workbook.
- Enter 1 to 5 in each row respectively in Column A.
- Highlight Column A and then select Plot > Statistical: Box Chart to create a simple box chart.
- Double click the plot to open the Plot Details dialog.
- To object Graph2, set the width and height of page on Print/Dimension tab.
- To object Layer1 , go to Size/Speed tab and set the size of Layer1.
- To object box, go to Pattern tab and set as shown below.
- Go to Percentile and Line tab, and select the same setting of grouped box chart Graph1.
- Go to Box tab, check the box before Box Label, Whisker Label and Mean Value Label, and shown them in Percentile, and then change the width of box into 20%, besides set the range of box and whisker.
- Click OK to apply your setting.
- Select and delete X axis, Y axis, Y axis title Range and Legend of Graph2.
- Press CTRL + C in Graph2, and then press CTRL + V in Graph1 to copy the graphical symbol into the box chart.
- Select the graphical symbol in Graph1, and then resize it and move it to a nice location.
At last, you will get the final graph.