6.6.3 Line Graph with Recession Bars

Summary

This tutorial will show how to create a line graph with recession bars. This type of graph is common when plotting economics data with periods of recession marked as vertical bars.

Line Graph with Recession Bars.png

Minimum Origin Version Required: Origin 2017 SR0

What you will learn

  • Plot a line graph
  • Add reference lines and fill paired reference lines to show recession bars
  • Set date display format in the Axis dialog

Steps

This tutorial is associated with <Origin EXE Folder>\Samples\Tutorial Data.opj. Open the Recession Bars folder from Project Explorer and the workbook Book1G is activated.

Add Reference Lines and do Alternate Fill to add Recession Bars

  1. Highlight col(A) and col(B) in the worksheet, choose Plot > Basic 2D: Line to create a line graph. Click on the line plot to select it and then use the Line/Border Color button Button Line Border Color.png in Style toolbar to set its color to red.
  2. Double-click on X axis to open the Axis dialog. Go to Reference Lines tab, click the interactive button Button Select Data Interactive.png beside the Reference Lines at Value text box to select col(C) from worksheet. Then the x coordinates of all recession periods will be listed in the display table as reference lines.
    Add Reference Lines.png
  3. Check Alternate Fill box to fill each period. And uncheck the Line check box to hide all reference lines (by checking the Line check box on Line column header and then unchecking it to remove all selections in this column).
    Fill paired Reference Lines.png

If you elect to show Label Text, you can choose <auto>, <value as entered> or enter your own custom string. For more information see The Reference Lines Tab, Label Text.

Customize the Display of Graph

  1. Click the Graph1 icon in the left panel (take care not to clear the check box beside it) and on the Display tab, set Color as Dark Cyan. Click the Layer1 icon, set the Color on the Background tab as White , clear the Data on Top of Axes check box and check Frame check box in the Display tab. Click OK to close this dialog.
    Display Color of Graph for Recession Bar.png
    Display Color of Backgroud for Recession Bar.png
    Line Graph with Recession Bars 01.png
  2. Double-click the X axis to open the Axis dialog. Click the Tick Labels tab, under Display page select 2016 from Display drop-down list.
    Tick Label Display.png
  3. Go the Format page and change Rotate (deg.) to 90, so that all tick labels will rotate 90 degrees. Click Apply to view the settings.
    Tick Label Rotate.png
  4. Go to the Scale tab and set the X axis scale as below:
    Scale setting.png
  5. Go to the Title tab and change the content in Text box to Year to modify the X axis title.
  6. Highlight Left icon on the left panel and change the Y axis title text to be (Index 2002 = 100) and click Apply.
  7. Go to the Scale tab again and this time the Vertical icon is selected which indicates it is the Scale tab for Y axis, set the From value to 0. Click the Apply button.
  8. Go to the Grids tab and show the major grid lines in LT Gray following the settings below:
    Set Grid Lines.png
  9. Click OK to apply the settings and close the dialog.
  10. Go back to the graph and delete the legend. Right-click on the layer and select Add/Modify Layer Title to add a title. Type Industrial Production: Durable Consumer Goods (IPDCONGD) in the text box. Highlight the text and click the Button Bold.png button on the Format toolbar. Adjust the text to an appropriate size by typing or selecting a number in the Font Size Button Size.png list in the Format toolbar. You should get the following graph.
    Line Graph with Recession Bars.png