OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                     
 
Skip Navigation Links
All BooksExpand All Books
TutorialsExpand Tutorials
GraphingExpand Graphing
StatisticsExpand Statistics

6.10.9 Notched Boxes with Variable Width Control


Summary

Origin's box plot is highly customizable. This tutorial shows how to create a notched box plot and control the box width by another dataset.

Tutorial Box Plot 01.png

Minimum Origin Version Required: 2015 SR0

What you will learn

  • Customize box plot settings
  • Use a dataset to control the box width
  • Customize the axis dialog for box plots
  • Add a fill area plot to a box plot as background

Steps to Control Box Width by Variable

This tutorial is associated with <Origin EXE Folder>\Samples\Tutorial Data.opj.

Also, you can refer to this graph in Origin Central. (Select Help: Origin Central menu or press F11 key , and then select Graph Sample tab, select Box Charts under the drop-down list)

  1. Open the Tutorial Data.opj and browse to the Box Variable Width folder.
  2. Activate workbook Book7, highlight columns A~F and then select Plot: Statistics: Box Chart. Next, select and delete the legend object from the graph.
  3. Double-click on one of the boxes to open the Plot Details dialog and go to the Box tab. Set Style to Notched Box. Select the Box Width by Parameter box and then set Box Width (%) to Number of Vehicles (in million) and enter 1.2 for Scaling Factor. Select the Outliers box. Outliers in Line is automatically checked.
    Tutorial Box Plot 04.png
  4. Click OK to close the dialog. Go to the Object Manager, which is docked to the right edge of Origin workspace, uncheck the last plot. And the click on the Rescale button Button Rescale.png to rescale the graph.
    Notched Boxes 01.png
    The graph will look as below.
    Tutorial Box Plot 01 2.png

More Box Style Customization Steps

The following steps can further customize the box plot.

  1. To use the same color for each box, double-click on any box to open the Plot Details dialog box. Go to the Pattern tab. Set Border Color as Orange. Set Width as 1.5.
  2. To fill the boxes with color, expand Fill Color drop down list, and in the Single tab choose a lighter orange as below:
    Tutorial Box Plot 03.png
  3. Note that checking Outliers checkbox in Box tab added a Symbol tab. Use controls on this tab to customize the outlier symbol as shown below:
    Tutorial Box Plot 05.png
  4. To hide the 99% and 1% symbols, go to the Percentile tab and clear the symbol for both 99% and 1%. Select the 2nd symbol in the first row for Mean:
    Tutorial Box Plot 06.png
  5. Click OK button to accept all the changes.

More Axis Customization Steps

  1. To show solid grid lines between each boxes, double click on the X axis to open the Axis dialog box. Go to the Scale tab with Horizontal icon selected and set the Count of Minor Ticks to 1:
    Tutorial Box Plot 11.png
  2. Select the Grids tab and select the Vertical icon. Check Show under Minor Grid Lines branch and set the Style as Solid.
    Tutorial Box Plot 12.png
  3. Go to the Line and Ticks tab and set the tick styles for X axis (Bottom):
    Tutorial Box Plot 14.png
  4. Hold Ctrl key and multiple select the Top and Right icons. Check the Show Line and Ticks box to also display line and ticks of top X and right Y axis, and set the tick style to None:
    Tutorial Box Plot 13.png
  5. Go to the Scale tab again and select Vertical icon. Set the following:
    Tutorial Box Plot 15.png
  6. Go to the Tick Labels tab, make sure Left icon is selected and enter a prefix of $.
    Tutorial Box Plot 16.png
  7. Go to the Title tab, make sure Left icon is selected and change the text of Y axis title to Gasoline Prices.
  8. Click OK to close the Axis dialog.
  9. To add a title and footnote in the graph, right click in white area of the graph and select Add/Modify Layer Title context menu. Type US Weekly Retail Gasoline Prices. Select the title and use the Format toolbar to set font size as 26. Right click below the X axis tick labels and choose Add Text... context menu. In in-place edit mode, click I button on Format toolbar and then type Box width indicates number of vehicles in each area as a footnote. It will show in italics.

Steps to Add National Average Line and Min&Max Range

Now, we are going to add three reference lines at Y axis to show the national average and minimum-maximum range of national gasoline price.

  1. Double-click on Y axis to open the Axis dialog again. Go to Reference Lines tab, click Details... button to open the Reference Lines dialog.
    Tutorial Box Plot 09b.png
  2. Click Add button at the bottom of Reference Lines dialog to add a reference line. Select this new line, set Value Type to Statistics, and enter Mean(plotdata(6, Y)) in the At Axis Value box(You can click the arrow at the end of this box to select a built-in pattern). Change the lint style to Royal and Dash, and check Show box under the Label node.
    Tutorial Box Plot 09c.png
  3. Click Add button again to add second reference line. With this line selected at the Reference Lines at panel, set Value Type to Statistics, and enter min(plotdata(6, Y)) in the At Axis Value box. Set Line Style to Royal and Solid.
    Tutorial Box Plot 09d.png
  4. Click Add button again to add third reference line. With this line selected at the Reference Lines at panel, set Value Type to Statistics, and enter max(plotdata(6, Y)) in the At Axis Value box. Set Line Style to Royal and Solid.
  5. Click OK button to close the dialog and add the reference lines to the line table.
    Tutorial Box Plot 10.png
  6. Enter National Average at the Label Text cell of first added line. And select the Fill To line for the second and third reference line as below:
    Notched box ReferLines 01.png
  7. Click Apply button to add the reference lines to the graph. Click Details... button again to open the Reference Lines dialog, select the second line at right panel, and then set Fill Color under Pattern node to Cyan and Transparency to 90. Click OK button.
    Notched box ReferLines 02.png
  8. Click OK button again to close the dialog. Go back to the graph, right-click on the label of the mean line to select Properties... from context menu to open the Text Object dialog. Enter the text below and do the format settings:
    National Average
    $$(v, *3)

    Notched box ReferLines 03.png

  9. Click OK button. At the end, you will get the final graph.
    Tutorial Box Plot 01.png
 

© OriginLab Corporation. All rights reserved.