Contour Plot on Cylindrical Coordinate

Origin’s 3D surface plots can read an extra matrix as the color source. However in practice, sometimes we do not really have that complete details of the data. So some math would be involved to reconstruct the entire object.

For example, in this post, we’d like to create a cylinder with color on it. While all we have is this file,  in which you’ll see all we have is three columns: Theta, Height, and Temperature. This is mainly just the information for color. Each row represents a point in 3D space, Theta is the angle between x axe and the xy projection of the point, Height be the Z height and Temperature be the color value. And from the design of this object/experiment, we also know that the Radius of the cylinder is 5.

Import the File into Origin

Just drag & drop it (or use any import method you know). Assume the data is now in [Book1]Sheet1.

Make the cylinder

A standard cylinder parametric function is: 

In the equation above, u is the height of each point, v the angle and r is the radius. In order to build the cylinder height enough, I’ve used a piece of simple script to get min/max height from the data.

Open menu File: New: Function Plot: 3D Parametric Function Plot menu. Fill in the expressions as below:

Clicking OK and you will have a 3D cylinder  graph and the corresponding Z, X, and Y values in matrix book called FUNC.


Notice the matrix title shows FUNC:  1/3, which means there are 3 matrix objects in the MSheet1 sheet and the 1st one is in display.

Right click the matrix title and choose Show Image Thumbnails. You will see the X and Y matrices as well.

Prepare Color Map Data Matrix

To add a color map to the cylinder surface, we must add a new matrix object in the same MSheet1 sheet so it has same dimension as the XYZ data.

Right-click the last matrix object thumbnail and choose Add to add a 4th matrix object.

Build Temperature Matrix from Source Data

Consider the color like we unwrap it off the cylinder first and place it flat on the table, it will then look like a regular 2D contour, in which the Y is the original Height value and X be the Arc. So we need to first calculate the arc length for each point. 

Then use the Arc as X, and Height/Temp being Y/Z to convert the wks to a matrix by menu Worksheet: Convert to Matrix: XYZ Gridding. And make sure the dimension of it keeps the same as the cylinder source, 50*50 in this case.

On clicking OK, a new matrix book will be created and you’ll need to manully copy&paste all its data to the 4th matrix we created in the previous step.

Wrap the Color onto the Surface

Double click the cylinder in the graph to open the Plot Details dialog and go to Fill tab. Change Front Surface mode to Contour fill from matrix and pick the last one Mat(4) in the list. Then go to Colormap / Contours tab, click the pencil icon next to Level column header. Click Find Min/Max so it finds correct value range of the Mat(4). Click OK.

 

About Zheng Shao

Male, single, alive.

View all posts by Zheng Shao →

Leave a Reply

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