Create Graphs for Data Files with Consistent Format

Occasionally we have been asked from people how to create many similar graphs from many data files with the consistent format. This article explains the Batch Processing method to achieve such repetitive graphing tasks.

By default when plotting a graph in Origin, it creates a independent graph window. Origin supports embed the graph window in worksheet in 3 ways:

  • in a cell in a worksheet
  • as a floating graph in a worksheet
  • in a single cell worksheet.

After graph is embedded in worksheet, user can save such workbook as a template and use Batch Process dialog to import multiple data file and generate multiple workbooks with data and embedded graph. In this blog, we will show how to embed graph as floating graph and do batch plotting. The F*.dat files used are located in <Origin Program Folder>\Samples\Import and Export\.

scr_BatchPlot_Float

Note: Origin also has a feature, called Batch Plotting, which lets you create many similar graphs with data already imported into worksheets.

 

Create Workbook Template:

1. Choose File: Import: Single ASCII… to import F1.dat file.  Then plot and customize the graph as you like. (You can set the rescale mode of x and y axes to “Auto” to rescale the graph automatically. But, if you want to hold the same axis scale unchanged, you should set the rescale mode to “Manual”.)

2. Right click in gray area of the worksheet and choose Add Graph flyout, select the graph in the Graph Browser, and click OK.) Now, you see your graph as a floating graph in the worksheet, and you can relocate or resize it.

(Note: If you want to embed the graph in a worksheet cell, you can create a new column, right-click a cell, and choose Insert Graph flyout. If you want to put the graph in a separate sheet, right-click on the sheet tab at the bottom of the sheet, and choose Add Graph as Sheet flyout.)

3. Choose menu Worksheet: Clear Worksheet… to clear the data. Then choose menu File: Save Window As which will save an empty worksheet window file with the extension, .OGW. This will make sure the OGW file size is small.

Batch Plot:

1. Click New Project button to start a clean project. Choose File: Batch Process to open the batch processing tool.

2. In this tool, please specify as follows:
a) Analysis Template: Navigate and set to the OGW  file you just saved.
b) File List: Navigate and select F1.dat, F2.dat and F3.dat under <Origin Program Folder>\Samples\Import and Export\.

3. Press OK,

Now the whole batch process would take place. You will see a progress bar and at the end, you get 3 workbooks. In each workbook, you will see the data file and corresponding graph. You can double click the graph window to customize it further. You can right click the floating graph and choose Restore window to change floating graph back into independent graph windows.

 

About Batch Processing dialog

Batch Process dialog usually is used to do batch analysis, e.g. there are analysis such as fitting, set column value calcuation, etc. in workbook. So it doesn’t accept OTW (workbook template files).

We extended it to do batch plotting. But File: Save Workbook as Analysis Template menu doesn’t work if there are no analysis or calculation in workbook. Therefore in step 3 of Create workbook template, we manually clear data in worksheet and then use File: Save Window as to save an .OGW file. We may improve this in future version

 

Pros and Cons of different ways to embed graph into worksheet

Place of the graph Graph size (if embedded)  Pro Con
Cell small – See data and graph side by side.
– Can contain many graphs compactly
– Graph related data or descriptions can be stored in the same column

– Default embedded graph is tiny.

– Need to resize cell height and width or merge multiple cells to make the graph bigger

 

– Not convenient to move the graph

Floating medium – See data and graph side by side.
– Easy to move and resize the graph
– Graph could block the data area
Sheet large

– Graph occupies the whole sheet

 

– Can’t see data and graph side by side.
– If the book contains many sheets, it becomes hard to manage the association between the data and the graph

 

Screenshot of the result when the graph is placed in a cell:
scr_BatchPlot_Cell

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Screenshot of the result when the graph is placed in a new whole sheet as a single cell:

scr_BatchPlot_Sheet

 

 

 

 

 

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *