# How to Make a Neat Double-X Graph

#### Introduction

Occasionally people asked us how to create a “double-X graph” in Origin. However, they often actually meant differently from each other in what was really envisioned. In this article, we will introduce three types of double-X graph, and briefly explain how to make them. Readers can download and modify the samples in this page for their own use.

#### Typology and Samples of Double-X Plots

1) Range-independent Double-X

In a multi-layer graph in Origin, each layer has own independent X (and Y) axis scale from the other layers. When the frames of two layers are identical in both size and location, you can show the second layer’s X axis as the top X (and Y axis as the right Y). Let’s call such graph as “range-independent double-X“.

The read-out of X2 value of a data point in the first layer’s curve is generally meaningless because X2 scale is independent from X1’s. The main purpose of this type of graph is to show two independent curves in a single graph.

To make a range-independent double-X graph, the easiest way is to use the tools in the Double-Y Toolbar, which can be downloaded and installed from our File Exchange site:

http://www.originlab.com/fileExchange/details.aspx?fid=165

By using the “XYXY Plot” button in this toolbar, you can easily make a range-independent double-X graph (with double-Y).

Note: Although there is an additional “Create Double X Plot” button in this toolbar, the graph created by this button presents two separate plots of the same Y data on mutually independent two X axes.

2) Functionally Mapped Double-X

In contrast to the freedom in scale of two X axes in the range-independent construction, the “functionally mapped double-X” graph has two X axes where the ranges (i.e., values of FromTo) at bottom and top X’s are mutually constrained by a mathematical formula. (Note that the positions of ticks within the X range don’t matter.) As in Fig. 3, the read-out of X value in both the bottom X1 and top X2 are meaningful because we regard the data point’s X value in two different measurements – X or f(X).  A typical situation is that two X axes at bottom and top are in different unit systems, e.g., Celsius and Fahrenheit in temperature. In other case, two X axes could have different scale types, e.g., linear at bottom X, and log scale at top X.

Steps to make a functionally mapped graph are as follows:

1) Create a XY plot where X goes to the bottom X axis.
2) Make a second layer in the graph by choosing Graph: New Layer(Axes): Top X(Linked Y Scale and Dimension) menu.
3) Open the Plot Details dialog at the layer level for the second layer (by pressing the layer icon of the second layer, then select “Format: Layer Properties” menu). Select Link Axes Scales tab in the dialog, and select “Custom” of X Axis Link, and give the link formulae for From value(=X1) and To value(=X2), e,g, for the conversion from Celsius to Fahrenheit:
X1 = 9/5X1+32
X2 = 9/5
X2+32

Note: To set a different scale type to the top X axis, you can enter the “identity function” to the link formulae for the second layer, that is: X1=X1, X2=X2. Then, you can simply change the X axis scale type to e.g., Log10 in the Axis dialog box (by double-clicking the top X axis).

3) Y-shared Double-X

When two X datasets share a single Y dataset in a worksheet like X1-Y-X2 in Fig. 5, the “Y-shared double-X” graph is created. To have such data, there may be various underlying models. For example, the input of the system(=x) varies over the uniform regular variable like Time(=t) to produce the Y output (Fig. 6(a)). In other case, there might be two independent X variables to produce the Y output (Fig. 6(b)). Also possibly, there is the only single independent variable, but which is hidden, and there are two different observations of X to be presented as X1 and X2 (Fig. 6(c)).

No matter which model is behind the data, we can construct the Y-shared double-X graph like Fig. 7 in a same manner.

Notice that here the tick labels of the top X axis are exact numbers like 0, 20, 40, … , and not only the major ticks, the minor tick marks are also not equally spaced based on the varying gaps of major ticks. To achieve such irregular scaling, we need to proceed the interpolation from the given data to determine the (major and minor) tick positions and labels. To make such graph easily by automatizing such calculation, a sample file is provided from the following link:

After downloading and unzipping this file, open it in your Origin. You can find a template worksheet – Following three columns for the source data, the first row in the next column contains the result double-X graph. The step-by-step procedure to operate this worksheet is as follows:

Procedure:
1) Enter X1,Y1,X2 data in the worksheet.
(If your data contains Y errors, enter the error
values into the column C (hidden).)
2) Double-click the embedded graph in the
first row of column E to expand.
3) Set the scale of the bottom X1 axis as you like.
4) Press “Set Up X2” button in the graph.
5) Enter the axis parameters in the appeared
dialog box based on the top-X axis range indicated at the top of the dialog. (See Fig.8)
6) Press “Refresh” button in the graph. Fig. 9. Y-shared double-X graph with top X ticks and tick labels at each data points.

Note: If you want to put the top-X ticks and tick labels at the positions of each data point like in Fig. 9, there is no need of the interpolation processes. You can simply set the properties of top X axis in the second layer such as:

• Scale tab, Horizontal, Major Ticks
Type = By Custom Positions
Position = X1 dataset
• Tick Labels tab, Top, Display subtab
Type = Tick-indexed Dataset
Dataset Name = X2 dataset

#### Afterword

The double-X graph means varieties. When you want to make a double-X graph, first you need to determine the type of double-X – either range-independent, functionally mapped, or Y-shared. Then, you can make the graph by the procedure accordingly described in this article. The file from the above download link contains samples of all three types of the double-X graph so that you can handily try them out. View all posts by Hideo Fujii →

### 4 Comments on “How to Make a Neat Double-X Graph”

1. Mohd khan より:

Hi There,
I have plotted a XYXY graph using this tutorial, really helpful.
But cannot add the error bars for both Y axes. Would you please provide the procedure ?

1. snow より:

Do you have YError data in some columns. If you set that column as YError by Column: Set As: YError menu.
Select the Y Error column for plot on layer1. Then with Layer1 active, drag the column into the graph. It will be added as YError for layer 1.
Then select Y Error column for plot in layer 2. With Layer2 active, drag the column into graph.

2. Tien より:
1. snow より: