1.2 Graph Templates and Batch Plotting



In this lesson we will learn about graph templates, and also how to perform batch plotting.

Graph Templates

Let's start with the project file we saved in lesson one: My First Graph. Click to select the graph window.

You can quickly open recently-saved project files from the File: Recent Projects list.

  1. Double-click on the axis tick label to open the Axis Dialog.
  2. Press the Ctrl key and select the Top and Right icons in the left list box. Choose the Line and Ticks tab and select the Show Line and Ticks check box then press OK.
    Template theme 01.png
  3. Now let's save the graph as a template. Right-click on the graph title bar, and choose Save Template As... from the context menu.
  4. In the dialog, set the Template Name as My Line and click OK to save the template.
  5. We will now generate a new column of data. Activate the worksheet, right-click on the gray area to the right of the columns, and select Add New Column from the context menu.
  6. Click inside the F(x) cell of this column, then right-click and select Open Dialog... from the context menu. You can use the shortcut Ctrl+Q instead of the context menu.
  7. In the dialog, enter the following expression into the top panel:
     B/A

    Template theme 02.png

    Use the Formula: Load Samples menu in this dialog to view various examples on setting column values. The Function menu offers a large selection of functions. You can also search for suitable functions using the search button located in the top right side of the formula edit box.

  8. Click OK to close the dialog and see the values in column C. Type sin(x)/x into the Comments cell of the column.
  9. Click on the header of column C to select the entire column. From the menu, choose Plot: Templates > User and from the drop-down menu select the My Line template we created before. A new graph will be created using data from column C.
    Template theme 03.png

Batch Plotting

In this section, we will perform batch plotting by first creating one graph and then cloning that graph using other data.

  1. Go to Project Explorer. In the upper panel, right-click on the root level and choose New Folder.
  2. Right-click on newly created folder, select Rename, and assign the name Batch Plotting. Click on the empty folder to open it.
  3. Using Windows Explorer outside of Origin, navigate to the folder <Origin EXE Path>\Samples\Import and Export\. Press the Shift key and choose the following three files:
    • S15-125-03.dat
    • S21-235-07.dat
    • S32-014-04.dat
  4. Drag and drop the selected files onto the Origin workspace. The selected files are imported into three new workbooks.
    Template theme 05.png
    Note: To import data files by drag-and-drop, you must not be running Origin as an administrator.
  5. Select one of the workbooks, then click on the header of column B and drag the mouse to column D, selecting all three columns. Then select the menu: Plot > 2D: Multi-Y: 3Ys Y-YY.

    Origin will look to the left of the selection to find the X column and plot the selected data against the the 1st column in the worksheet.

  6. Double-click inside the layer to open the Plot Details dialog. In the left panel, we can see there are three layers. Expand Layer1 and choose the plot under it. Then in the right panel, change the line width by choosing the Line tab and setting Line Width as 3. Repeat the line width setting for the plots in the other two layers by selecting them from the left panel. Click OK to close the dialog and apply the settings.
  7. Now we will clone this graph using data in the other workbooks. Right-click on the title bar of the graph and select Duplicate(Batch Plotting), and then the Select Workbook dialog will be opened.
  8. In the dialog, press the Shift key and select the two workbooks in the top box.

    You can set the Match Plot Columns by drop-down appropriately to find worksheets in the project that match the data configuration of the current graph.

  9. Click OK. If prompted to rescale the axes to show all data, answer Yes and click OK. Two similar graphs will be created with data from the other two books.
    Template theme 04.png
  10. From the menu, choose File: Save Project and save your modified project.