Note: Starting with Origin 2016, you can now do the same thing I outline in this post with with one of our Apps – 3D Wall Profile. In fact, the App makes it much, much easier to do (and has more options) than the method presented in this blog post. For Origin 2015 users, you may read on if you wish to create this graph.
In this post, we will learn how to add “profile lines” to a 3D Colormap Surface Plot by “projecting” them into the side planes of the graph.
Note: This post and project was created using Origin 2015. Some of the features may not work the same in earlier versions of Origin.
If you’d like to follow along, download the zip file 3D Surface with Profile Lines and open the OPJ. Finished graphs are available in the “Finished” folder of the project.
The data in sheet “SurfaceData” of Book1 is formatted for a virtual matrix with the X values in Col(A) and the Y values in a header row entitled “Y Values”. Col(B) to Col(C124) contain the Z data for each XY pair.
First, we will create a 3D Colormap Surface plot for the data. In the worksheet, highlight all columns and from the 3D and Contour Graphs toolbar, click the 3D Colormap Surface button. The Plotting: plotvm dialog will appear. Change the settings to exactly match those in the image below including naming the virtual matrix “VMSurface”.
Now click the OK button to generate the graph.
We are interested in two types of profile lines from this data: an “X profile for a given Y value”, and a “Y profile for a given X value”. The image below illustrates how these two profiles work.
The “X profile” data is in the worksheet columns while the “Y profile” data is in the rows. To speed up things up, profile data has already been extracted into 2 worksheets named “XProfileData” and “YProfileData”.
You can see XProfileData sheet is created by
- Copying 1st X column in SurfaceData sheet and pasted into into Column A here.
- Copying C57 column (with Y value=714) from SurfaceData sheet and pasted into column C . Don’t forget to set column C as Z.
- Entering 714 in F(x) formula row of column B.
YProfileData sheet is created by
- Highlighting Y Values row on SurfaceData sheet and copying it, and then pasting transpose to column B on YProfileData sheet.
- Highlighting 329th row on SurfaceData sheet, copying it, and then pasting transpose to Column C on YProfileData sheet. Don’t forget to set column C as Z.
- Deleting the 1st row since for it shows missing and 1173.65 in column B and C.
- Entering 1173.65 in F(X) cell of Column A.
To plot the XProfileData into the 3D graphs,
- make Graph window and the workbook show side by side.
- Highlight column C on XProfileData sheet.
- Mouse over the edge of column C border so it shows as a graph icon. Press the mouse and drag it into Graph.
- Click OK in the popup dialog to add the plot.
It’s plotted as 3D scatter plot with drop lines. Double click on the droplines area to open Plot Details dialog.
We only want the profile shows on ZX Projection. So uncheck Original checkbox. Check ZX Projection. On Symbol tab. set Size to 0.
Activatie Line tab, check Connect Symbols and customize the color and line thickness as needed. Click Apply to see the X Profile added on ZX plane.
Do the same for YProfileData. The only difference is check the YZ Projection checkbox on left panel of Plot Details dialog since we want the Y profile to show on YZ plane. Both profiles will be added in graph.
Lastly, use Axis dialog to add special ticks labels Special Tick Labels. Let’s add one label along the X axis and one along the Y axis as per the images below.
You can also turn off the XY gridlines and contour lines on original surface plot. Here is the final graph. We’ve included a version with filled area below profiles which is done by turn on droplines.
2 Comments on “Creating a 3D Surface Plot with Profile Lines”
It’s great. Can i translate it to Chinese and post in my Wechat？
Definitely you can.
BTW, we have made an APP in Origin2016 to easily add profiles lines in 3d surface plot.
That will make your life even easier.