The following two graphs are the contour plots of Mt. St. Helen and its surrounding area before and after the eruption in 1980. Occasionally people want to calculate the difference of the Z values (in this sample, the altitude) of such two contours, and to make a new contour plot of the difference. If the two contour plots are given as two matrices with the same dimensions, then what is needed to do is simply subtracting a matrix from the other. However, if the the data of the contours are given as XYZ datasets, you need to interpolate datasets to make their rows corresponding each other to make them subtractable from one to the other.

You can try the following procedure to produce the contour like Graph3 below by subtracting Graph1 from Graph2 above, using the sample Origin file, which can be downloaded from this link .

**[Procedure]**

1) In this sample file, you find two workbooks, Book1 and Book2 – the former contains the XYZ data before the eruption, and the later data after the eruption. First, append the XY data (not Z) (from row 1 to 1600) in Book2, to the end of Book1, after row 1024 as shown in the screenshot below. Do the same to append XY data of row 1 to 1024 from Book1 to Book2.

2) Now, we make two worksheets have exactly the same XY positions using interpolation. For Book1, select the menu, **Analysis: Mathematics: Interpolate Z from XY.**

In the **Interpolate Z from XY** dialog, click > button next to **XY Values to Interpolate** and pick** B(Y)**, click > button next to **Input** and pick** C(Z)**. Click > button next to **Result of Interpolation** and pick** C(Z)**. Set the **Method** of interpolation, for example **Random TPS** in this sample. Click **OK**. The rows 1025-2624 of **C(Z)** are filled with values as well. No lock shows in C(Z) because **Input** 、 **Result of Interpolation** are both set to **C(Z)**. Do the same operations for Book2.

3) To set the same XY data order in Book1 and Book2, For Book1, select **Worksheet: Sort Worksheet: Custom** menu, choose **A** and click **Ascending>>** button. Then choose **B** and click **Ascending>>** button. This will do a nested sort. Column A will be the primary sort column and column B will be the secondary sort column. Do the same operations for Book2. Their XY arrangements are now identical.

4) Finally, we can subtract the Book1’s Z data from Book2’s Z data. To do so, first, add a column D in Book1. Copy-and-paste the column C(Z) column in Book2 to column **D** in Book1. Add another column E in Book1. Use **Set Column Values** tool to calculate column E by **col(D)-col(C)**. Right click column E and set as Z. We are now ready to make a contour plot for the difference between Book2 and Book1.

5) Select column E(Z), and make a contour plot. Corresponding A(X) and B(Y) will be used to create the Contour plot. You can customize as you like. You get a contour like Graph3.