This is an archived page, please click here to view the latest updates.
See more related video:Contour Plots and Color Mapping
Contour graphs are surface graphs of XYZ data, plotted in 2D space. Viewing a contour graph is the same as viewing a 3D surface graph from a vantage point perpendicular to the XZ plane. In contour graphs, ranges of Z values are distinguished by different colors or levels of gray scale, labeled contour lines, or both.
Origin provides six contour graph types:
|Graph Type||XYZ Columns in Worksheet||Matrix Window||Virtual Matrix in Worksheet|
The (Plot Details) Color Map/Contours, Label, and Numeric Formats tabs provide controls for editing your contour graphs.
Note that a contour plot in Origin can be created from matrix data, worksheet data, or virtual matrix data. Creating a contour plot from a matrix is faster than creating a contour plot directly from a worksheet, so the matrix method is suitable for large data. On the other hand, creating a contour plot directly from XYZ worksheet data uses a triangulation method to generate the contour lines, and there is no need to generate a matrix. Besides that, there are other advantages to creating contour graphs from XYZ worksheets:
Compared to creating contour graphs from a matrix, creating graphs from a virtual matrix can let the graphs have nonlinear X/Y axes.
To create a Contour graph from matrix data or worksheet data, you just need to select the data, and click the graph button on the 3D and Contour Graphs toolbar or select a graph menu option under the main Plot menu. To create a graph from a virtual matrix, you can only click the graph button on the 3D and Contour Graphs toolbar to bring up a dialog to help you set the XYZ data and then create the graph. For more details about creating graphs from virtual matrices, please refer to Creating 3D and Contour Graphs from Virtual Matrix. We have also introduced each Contour graph type, in detail, in Contour Graphs; you can get more details from there.
The customizations of Contour graphs are mainly done in the Axis dialog and the Plot Details dialog; you can get more details about the Axis dialog to learn how to customize the axes of a graph from Graph Axes. To get more details about the Plot Details dialog, please refer to Customizing Your Graph.
There are some very useful and important features, only available with contour graphs, with which you can make your graphs unique and beautiful.
In addition to controlling contour labels in the Color Map/Contours tab of the Plot Details dialog, you can manually add contour labels for a selected contour line. To do this:
Note that this command is accessible only when you have selected a single contour line.
After adding the label, you can use the Remove Contour Label(s) command to remove it. When you click a contour line twice to select all the lines with the same z value, you can right-click to choose this command from the context menu and remove all the labels added to this level. When clicking a third time to select a single contour line, you can use this command to remove the label associated with this line.
The context menu that appears when you right-click on a selected contour line offers another menu command: Extract Contour Lines. This menu command can be used to extract the data of the selected contour line to a new workbook. When you right-click in the contour plot, rather than on a contour line, the Extract Contour Lines option that appears in the context menu will extract the data of all showing contour lines to a new workbook.
Contour plots can be created directly (without gridding) from (x, y, z) coordinates (Cartesian coordinates) or (r, θ, z) coordinates (cylindrical coordinates). If your data are in (r, θ, z) coordinates, Origin first converts the data to XYZ space before making the contour plot. Conversions between (x, y, z) and (r, θ, z) coordinates are expressed as:
In Cartesian space, creating a contour plot is a four step process:
All data points are connected to create Thiessen (Delaunay) triangles in the XY plane. The triangles are constructed so as to make them as equiangular as possible. In addition, no two triangles should intersect. Note that any side is shared by two adjacent triangles, unless it is located at the edge of the mesh.
To find the intersection points of the contour lines and the triangle sides:
Given a contour level zc, Origin traverses all the triangles to see whether or not the contour line for this level intersects with the triangle sides. If a triangle side has intersection with the contour line, it will be marked as a characteristic side. The coordinates of the intersection point, which will be referred to as a characteristic point in this document, will be computed with linear interpolation.
For a triangle side that connects two triangle vertices: I(xi, yi, zi) and J(xj, yj, zj), we will examine whether the following is true:
If it is true, we will say that this side is a characteristic side. Furthermore, if the product on the left of the inequality is zero, it will mean that the contour line passes through at least one of the vertices. In this case, zi and zj will be adjusted by subtracting a small value, , so as to make sure that the characteristic point will not be a vertex. The adjustment is as follows:
If this side is a characteristic side, the coordinates of the characteristic point on it can be computed by linear interpolation in the following way:
Origin keeps records of all the characteristic sides and the coordinates of the characteristic points for future use.
Note that if a triangle intercepts the contour line, it will have exactly two characteristic sides.
To draw a contour line, we have to trace all the characteristic points on it.
If there is a characteristic point on the boundary of the triangular mesh, the tracing will start from that point. Otherwise, the tracing will begin with a random characteristic point.
Recall that a triangle that intercepts the contour line must have exactly two characteristic sides, and that a side which is not on the edge of the mesh must be shared by two triangles. Therefore, the tracing can go from one characteristic side (Side A in the following figure) to the other characteristic side of the same triangle (Side B in the following figure). If the latter is not on the edge of the triangular mesh, we will certainly find another triangle (Triangle 2 in the following figure) which shares this side with the current triangle (Triangle 1 in the following figure). Then we can find the characteristic point on the other characteristic side (Side C in the following figure) of this new triangle. In this way, the tracing continues until the edge of the mesh or a characteristic point which has already been traced is reached. (In the former case, the contour line is open; while in the latter case, it is closed.) Then the number of characteristic points that have been traced is compared with the total number of characteristic points for this level. If they are not equal, it will mean that there are still some characteristic points which have not been traced. The tracing will go on until all characteristic points have been traced.
After the tracing, the characteristic points are connected with B-Spline curves. Then smoothing is performed on all the contour curves.