# 6.10.3 Marginal Distribution Curve

## Summary

Graphs in Origin are highly customizable. This tutorial will show how to customize the marginal histogram to display distribution curves instead of columns.

Minimum Origin Version Required: 2015 SR0

## What you will learn

• Create marginal histogram
• Use filter lock to create plots with different filter conditions.
• Group plots manually

## Steps to Use the Filter Lock

Origin9.1 includes a special feature that allows you to set up different data filters in a single source worksheet and to, for instance, graph data for each filter condition without destroying the previous plot. This is made possible by copying filtered data to a new sheet and placing a "filter lock" on the filtered data.

1. Import <Origin EXE Folder>\Samples\Statistics\automobile.dat to a new blank workbook.
2. Highlight col(A), right click and select Filter: Add or Remove Filter.
3. Click the filter icon in the column header and select Between....
4. In the Between dialog, set From to 1992, To to 1995 and press OK.
5. Highlight Col("Power") and Col("Weight"), right-click and select Copy Columns to....
6. In the colcopy dialog, enter 1992~1995!<new> in the Destination Columns text box as shown below and click OK.
7. In the newly created sheet, click the green lock in the Col(A) heading and select Worksheet Filters: Lock.
8. Go back to the "automobile" sheet and repeat steps 4~7 twice more with Col("Year")'s filter conditions set to 1996~1999 and 2000~2004, respectively. You need to type a sheet name in colcopy dialog manually each time. The filter conditions are locked with each sheet, you can push them back using Worksheet Filters: Push Back.

## Steps to Create a Plot with Marginal Distribution Curves

1. Go to sheet "1992~1995", highlight all columns and select Plot > Statistical: Marginal Histograms
2. Double-click any on any bar in the top histogram to open the Plot Details dialog. Go to the Data tab and set Distribution Curve: Type as Normal. This is for Layer 2.
3. Go to the Pattern tab and reproduce the settings shown below to hide bin bars.
4. Go to the Line tab and set Color to Black. Click Apply to see the changes.
5. Repeat steps 2~4 for Layer3 (right histogram).

## Steps to Plot Grouped Marginal Distribution Curves

1. Select Graph: Plot Setup from menu.
 In order to show all three panels in Plot Setup dialog, please expand Plot Type panel by clicking and expand Available Data panel by clicking again. Please refer to Plotting using Plot Setup for more information.
2. Select Layer 1 in lower panel. Set controls as shown below and click Add.
3. Add the "Power" histogram to layer2.
4. Add the "Weight" histogram to Layer3.
5. Repeat steps 2~4, to add 2000~2004 data to each layer. The plot list should look like the following.
6. Click OK to close the Plot Setup dialog box and rescale the graph.

## Steps to Group the Plots

1. Right-click the layer icon at the upper-left corner of the graph window and select Layer Contents....
2. Highlight all three plots and click Group, then click OK.
3. Repeat step 2 for layer2 and layer3.

## Steps to Further Customization

1. Double click the bottom axis to open the Axis Dialog for layer 1, then go to the Scale tab, and set the axis scale for the Horizontal(X axis) and Vertical(Y axis) as below respectively:
2. Click OK to close axis dialog. Double click on the graph to open the Plot Details dialog box and select the first dataplot in layer 1 to go to Group tab. Set Symbol Type as None and duplicate the following settings:
3. Click Ok to close the dialog. Go to the Symbol tab and duplicate the following settings.
4. Go to Layer 2, Data tab and set the bin scale to be the same as the X scale, then click Apply.
5. Go to the Group tab for plots in Layer 2 and set the Edit Mode to Independent so that we can individually customize the plot styles, click Apply.
6. Go to the Pattern tab and hide bars for all three dataplots in Layer2 as what we did in Steps to Create a Plot with Marginal Distribution Curves, Step3.
7. Go to Line tab of the 1992~1995 data plot and set as below.
8. Repeat step 7 for the other two plots in Layer2 and set line color to the corresponding symbol color in Layer1.
9. Repeat steps 5~8 for Layer3, click OK to close Plot Details dialog and apply settings.
10. Activate Layer1 and select Graph: Legend: Data Plots from the menu.
11. Right click the legend object and click Properties..., set Background to Black Line, and font Size to be 18. Click OK.
12. Use Format: Page to open the Plot Details - Page Properties dialog, go to Legends/Titles tab and set as the following so that worksheet name will be used as legend text:
13. Drag and move the legend to a new position as needed. At this stage the graph should look like below:

## Steps to Reposition the Graph Layers

1. Double click bottom axis to open Axis Dialog for layer 1, go to the Grids tab, hold Ctrl key to multiple select Vertical and Horizontal icon and set the following:
2. Click OK to close dialog. Open the Axis Dialog for layer 2. Go to the Line and Ticks tab, make sure Bottom axis icon is selected and clear the Show Line and Ticks check box to hide the bottom axis line. Do the same for the axis line of Left in layer 3.
3. Open the Layer Management dialog box, highlight Layer2 then go to the Size/Position tab, select Move and set Top to be -35. Click Apply.
4. Set Left for Layer3 to be 102. Click Apply. Then click OK to close the dialog box.