6.10.2 Grouped Box Chart with Color Indexed Data Points
Origin can be used to create grouped box plots from raw data with data points and distribution curves.
Minimum Origin Version Required: 2015 SR0
What you will learn
This tutorial will demonstrate how to:
- Create a grouped box plot from raw data
- Add a data plot with indexed symbol color
- Add and customize a distribution curve
- Customize the table-axes
Creating the Box Plot from Raw Data
This tutorial is associated with <Origin EXE Folder>\Samples\Tutorial Data.opj.
- Open Tutorial Data.opj and browse to the folder Grouped Box with Index Color DataPoint.
- Activate the workbook Book 5.
- Highlight col(E) - col(J):
- On the 2D Graphs toolbar click the small triangle at the bottom of the sixth button to reveal the fly out menu. Select Grouped Box Charts - Raw Data as shown below:
- In the Plotting: plotgboxraw dialog, set the Group Number to 2, the 1st Group Row to Comments and the 2nd Group Row to Long Name. This will create a box chart with the column data arranged in three groups of two, with X axis row names derived from the Comments and the Long Names on the worksheet:
- Click the OK button. The grouped box chart from raw data is created with two grouping levels as shown below:
- To add data points in the graph, double click the plot to open the Plot Details dialog. Expand the Layer1 option on the left panel and select the first plot under it.
- On the Box tab, set Type to Box[Right] + Data [Left]. Click the Apply button. This will add two new tabs to the dialog: Data and Symbol
- To add a Distribution Curve, on the Data tab, set Distribution Curve Type to Normal. Set Bins Alignment to Right to orient the curve.
- Click the OK button. The data points and distribution curves will appear on the graph as shown below:
Customizing the Boxes and Statistical Markers
- Double click on the any one of the boxes to re-open the Plot Details dialog.
- On the Group tab set both Border Color and Box Color to increment By One so each box in subgroup has a different color.
- Click the button on the Details section of Border Color. In the Increment Editor dialog that opens, click the first color and change it to be Red. Change the second color to Gray. Click OK.
- Click the button on the Details section of the Box Color to open the Increment Editor dialog. Click 1st color and click Define Custom Color button.
- Set RGB values in Red, Green, Blue boxes on bottom right to be 255, 51 and 51, and click OK to close dialog.
- Do the same for the 2nd color. Set Define RGB value to be 143, 143 and 143, and click OK to close dialog. Then click OK to close Increment Editor dialog and apply settings.
- This step is to customize the descriptive statistic markers whether to show on the plot such as the 99%, 1%, Max and Min marks.
Go to the Percentile tab, and set the Edge Color to White and click Apply button. Since background of the graph is also white, Max, Min, 99%, 1% will look like disappeared in graph.
On Percentile tab, users can also hide a Marker by setting the Type as None(the last shape) in the dropdown list.
- On the Lines tab set the Color for the Whisker and the Caps to Gray and Median Line to White.
Click OK. The plot should appear as shown below:
Customizing Data Symbols and Distribution Curves
- Double click any box in the graph to open the Plot Details dialog.
- On the Symbol tab. Set the Size to 5, the Shape to 2 Circle and the Interior to Open.
- Click the Edge Color dropdown list and choose Indexing: Col(B):Machines. The symbol's edge colors will be indexed to column B. All symbols with Machine value A386 will be one color and the ones with C334will be a different color:
- When symbol color is indexed, another tab Color List will appear in the dialog. To set a user defined color increment list, go to the Color List tab. Enable the Use custom increment list box and set the first two Color Values as Blue and Dark Cyan.
- To customize the distribution curve color, on the Lines tab, set the Distribution Curve Color to Gray.
- Click OK to close the dialog.
Customizing the Axes
For grouped plots support multi-row tick label tables. The corresponding axis icons in the Tick Labels tab of Axis dialog starts from the last table row, e.g. Bottom 1, Bottom 2, ..., Bottom N. This means the first row from the bottom will correspond to Bottom1 and so forth.
- To move the tick label row with SEG 1, SEG 2 and SEG 3 to the top X axis, double click on this tick label row.
- This opens the Axis Dialog with the Bottom 1 axis icon selected. Right click the Bottom 1 icon on the left panel and choose Move to Opposite.
- Click the Apply button. The SEG 1, SEG 2 and SEG 3 tick label row will now appear at the top X axis on the graph, and as the axis icon is renamed as Top 1 on the left panel in the dialog.
- The previous Bottom 2 icon will become the Bottom 1 icon. Select the Bottom 1 icon. Go to the Table tab. Set the Number of Rows to 3. Click the Apply button. Three identical bottom tick label tables will appear on the graph and they are Bottom 1, Bottom 2 and Bottom 3.
- To fill first bottom tick label row with light gray, select the Bottom 3 icon on the left panel, make sure you are still at the Table tab and clear the Auto check box to enable separate control of tick label table layout. Set Fill Color as LT Gray and deselect the Inside Border check box under Table Layout node.
- The second row derives the labels from col(C) of the second worksheet A386_CC.MI. Select the Bottom 2 icon and go to the Display tab, set the Type to Text from dataset and set the Dataset Name from the drop down as [Book5]"A386_CC.MI"!C"N".
- Go to the Format tab and clear the Auto check box, change the Color to White. Then go to the Table tab and set as the following:
- Select the icon Bottom 1, go to the Display tab, set the Type to Text from dataset and then set the Dataset Nameas [Book5]"C334_CC.MI"!C"N" since it uses col(C) from the third worksheet C334_CC.MI.
- Go to the Table tab and set the table layout as below:
- Select the Top 1 icon, go to the Table tab and set the table layout for top axis as below:
- Then go to the Format tab， set Font Size to 22 and change the tick labels to Bold:
- For the Y Axis change to the following settings:
- Scale tab (Vertical icon): Set Increment to 5000
- Tick Labels tab >> Display tab (Left icon): Set Display to Scientific 10^3
- Click OK to close the dialog.
- Select Y axis title Range and press the Delete key to remove it.
Updating the Legend and Adding Text Objects
- Right click the box chart legend and select Legend: Box Chart Components... to open the Enhanced Box Legend: legendbox dialog. Deselect all the components except for Data:
- Click the OK button. The legend will show only the data symbols. Double click the legend text to go into in-place edit mode. Delete the first row of the legend. Select and drag to move the legend object to a better location.
- To remove the black line around the legend, right click the legend object and choose Properties.... In the Object Properties dialog, go to Frame tab to set Frame to None.
- Origin doesn't support tick label table titles yet. But users can add text objects manually. Right click on the white space to the left of the second bottom tick label row and choose Add Text... from the context menu that appears. Type NA386=. Then, still in in-place edit mode, highlight A386 and click the button on the Format toolbar to change it into subscript. Select and drag to adjust the positioning.
- Add another text object NC334= to the left of the third tick label row and change C334 into subscript.
The final graph should appear as shown below:
You can click to select table labels and nudge them using the arrow keys on your keyboard.