6.10.3 Marginal Distribution Curve


Video Image.png Video Text Image.png Website blog icon circle.png Blog Image 33x33px.png

Summary

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

Marginal distribution curve 01.png

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.
    Marginal distribution curve 02.png
  7. In the newly created sheet, click the green lock in the Col(A) heading and select Worksheet Filters: Lock.
    Marginal distribution curve 03.png
  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
    Marginal distribution curve 04.png
  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.
    Marginal distribution curve 05.png
  3. Go to the Pattern tab and reproduce the settings shown below to hide bin bars.
    Marginal distribution curve 06.png
  4. Go to the Line tab and set Color to Black. Click Apply to see the changes.
    Marginal distribution curve 07.png
  5. Repeat steps 2~4 for Layer3 (right histogram).
    Marginal distribution curve 08.png

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 Button Expand Preview Up.png and expand Available Data panel by clicking Button Expand Preview Up.png 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.
    Marginal distribution curve 09.png
  3. Add the "Power" histogram to layer2.
    Marginal distribution curve 10.png
  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.
    Marginal distribution curve 22 Plot list.png
  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 Layer Icon 1st.png at the upper-left corner of the graph window and select Layer Contents....
  2. Highlight all three plots and click Group, then click OK.
    Marginal distribution curve 12.png
  3. Repeat step 2 for layer2 and layer3.
    Marginal distribution curve 11.png

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:
    Marginal distribution curve 17.png
    Marginal distribution curve 17b.png
  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:
    Marginal distribution curve 13.png
  3. Click Ok to close the dialog. Go to the Symbol tab and duplicate the following settings.
    Marginal distribution curve 14.png
  4. Go to Layer 2, Data tab and set the bin scale to be the same as the X scale, then click Apply.
    Marginal distribution curve 19.png
  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.
    Marginal distribution curve 15.png
  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.
    Marginal distribution curve 16.png
  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:
    Marginal distribution curve 16b.png
  13. Drag and move the legend to a new position as needed. At this stage the graph should look like below:
    Marginal distribution curve 16c.png

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:
    Marginal distribution curve 18.png
  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.
    Marginal distribution curve 20.png
  4. Set Left for Layer3 to be 102. Click Apply. Then click OK to close the dialog box.
    Marginal distribution curve 21.png