Tutorial:Merging and Arranging Graphs

From Howto Wiki

Jump to: navigation, search



The Merge Graph Windows dialog allows you to select which graphs you wish to combine, choosing from any graph in the project. It also has controls to specify how you want the individual graphs arranged on the new page.

The Object Edit toolbar allows you to quickly align and size multiple layers.

The Layer Management dialog lets you add, arrange and link layers on a single graph page.

This tutorial will show you how to:

  • Merge multiple graphs into one graph
  • Resize and align layers quickly
  • Add a second axis using a nonlinear relationship with the primary axis
  • Use Layer Management for more complex layer positioning and linking

Creating a Merged Graph from Multiple Graphs

  1. Import the two files sensor01.dat and sensor02.dat from \Samples\Curve Fitting\, as separate sheets in separate books, using the file names as the sheet names. (Please read the Importing Data tutorial for how to import files.)
  2. Select the Y column of one sheet and create a line plot. Repeat with the Y column of the other sheet and create a second line plot. You will have two separate graph windows at this point.
  3. Now, to merge the two graphs into one page, bring up the merge graphs dialog from Graph: Merge Graph Windows. In this dialog, the default setting for merging graphs is All in Active Folder (Open), so the two graph windows are already listed in the Graphs box.
  4. Specify the following settings to merge the two graphs: 1), Uncheck Keep Source Graphs. This will remove source graphs after merging. 2) Arrange the layers as one column and two rows. 3) Check Show Axes Frame. In this example, the two layers share the same X axis range, so we can hide the overlapped X axis. 4) Set the Vertical Gap to 0 for the two layers. 5) Change page orientation to Portrait. Then the source plots will be added as layers in the new graph page.
  5. Click OK to close the dialog, and a new merged graph page is created:
  6. Double-click the top X-axis and add tick labels as below:
  7. The two graph legends are the same in the output page. For the graph legend, Origin uses the worksheet column's Comments label row, or if that's empty it will use the Long Name if there is one, and if not, the Column name. To modify the legends, select Graph: Update Legend from the menu to open the legend update dialog. You will change the legends for the Whole Page, and Reconstruct them. Select Custom from Auto Legend Translation Mode and enter @ws in the Legend Custom Format edit box. Here, @ws means Origin will use the worksheet name as the graph legend.

Aligning Layers using the Object Edit Toolbar

  1. Select File:Open and open the OPJ \Samples\Graphing\Layer Management.opj and go to the subfolder Arranging Layers. (If you don't see the subfolders, click View: Project Explorer to open the Origin Project Explorer window.)
  2. Now we want to use the Object Edit tools to rearrange the graph. Make sure you already opened this toolbar, or you can open it from the View: Toolbars dialog.
  3. On the graph, hold the Shift key down and click on all four layers to select them as a group. Then press the Uniform Width Image:Button_Uniform_Width.png and Uniform Height Image:Button_Uniform_Height.png buttons on the Object Edit toolbar to make them the same height and width.
  4. Click and select the bottom two layers and click the Bottom Image:Button_Bottom.png button in the Object Edit toolbar to align them. Do the same thing for the top two layers, then click the Top Image:Button_Top.png button to align them.
  5. Now click and select the top and bottom on the left column, and do Left align Image:Button_Left.png, then repeat for the other two in the right side column by Right align Image:Button_Right.pngbutton.
  6. Image:Tip_icon.png

    The object edit toolbar provides a quick way to align and set the size of layers. The first layer you select is the reference layer and all others will adjust according to that one. The Layer Management tool provides many more options, such as reordering and linking layers, in addition to setting size and alignment.

  7. Do not save changes to your project, as the same project is used later to demonstrate Layer Management.

Displaying Opposite Axes with a Nonlinear Formula

An Origin 2D graph layer is a set of X, Y axes, and opposite axes can be turned on for both X and Y. In addition, the opposite axes can also display labels using any user-specified nonlinear formula with respect to the primary axis.

  1. Using the Project Explorer window, switch to the subfolder named Nonlinear Axis.
  2. With the graph active, bring up the Layer Management tool by selecting Graph: Layer Management.
  3. Switch to the Axes tab and expand the Top branch and check the Axis, Title, and Tick Label check boxes.
  4. We want to display the labels on the top axis in units of Energy and the relationship between wavelength and energy is:
    Energy (eV) = 1240/Wavelength (nm)
    So in the Formula box, enter: 1240/x and click Apply, then click OK to close the dialog.
  5. Double-click and edit the top X-axis title and change it to: Energy (eV)
  6. Double-click the top axis labels or axis, to open the X-Axis dialog. Switch to the Custom Tick Labels tab, and then click Hide radio for At Axis Begin, to hide the missing value label for energy that corresponds to zero wavelength.

If you are setting up a nonlinear relationship for the right Y-axis, in the Formula you still need to use x instead of y.

Using Layer Management to Link and Position Layers

The Layer Management tool can be used to position, resize, swap, and link layers in order to establish the desired relationship between layers, as demonstrated in the following steps:

  1. Reopen the project \Samples\Graphing\Layer Management.opj and then switch to the subfolder named Arranging Layers. You can reopen the project by selecting File: Recent Projects: Layer Management.opj. Do not save changes to the project.
  2. Bring up the Layer Management tool from Graph: Layer Management. Then go to left panel and rename the layers so that they are, top to bottom: Peak 3, Peak 2, Peak 4, Peak 1. The layer names now correspond to the legend for each layer. Note: to rename a layer, double-click on the name, as the hint text in the dialog says.
  3. Now drag and arrange the list on the left so that they are ordered Peak 1, Peak 2, Peak 3, Peak 4. The layer number and names now match.
  4. Now switch to the Arrange tab and do the following steps: 1) Uncheck the Link Layers check box. 2) Check Show Axes Frame. 3) Leave the Number of Columns and Number of Rows edit boxes as 2 by 2. 4) Set Horizontal Gap and Vertical Gap to 0.
    Click Apply. This resizes and repositions the layers so they are aligned, and hides ticks and labels where layers overlap.
  5. Now go to the Axes tab, hold down the Ctrl key and select Peak 1 and 3 on left list, then expand the Left branch and set tick direction to In, and click Apply.
  6. Now select Peaks 3 and 4, set the Bottom tick direction to In and click Apply. Then select Peaks 1 and 2, set the Top ticks to In and click Apply.
  7. Now go to the Link tab and select Peaks 2, 3, and 4 in the left list and link them to layer 1, making sure you have the X-Axes linked Straight(1 to 1), and click Apply.
    Then click OK to close the dialog.
  8. Click and select the top left layer, layer 1, then drag and resize the layer and move the layer. Note that the other layers resize and move too, since they are linked by dimension to layer 1.
  9. Go to the top left layer (layer 1), and double-click the top X-axis. In the X-Axis dialog, change the X-Axis scale From 10 To 35, and click OK. You'll see that all the other layers now show the same new x range, as they are all linked in X.

When arranging linked layers, they are treated as one unit, so you should first unlink them if you need to rearrange and then you can link them again after arranging.

Personal tools