OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                     
 

6.1.4 Basic 3D Plotting

Summary

In Origin, Contour plots and 3D plots, such as Color Map Surface plots, can be created directly from XYZ data.

But, if you want to plot a smoother 3D surface, you are strongly advised to use one of Origin's built-in gridding routines to convert the XYZ data into a matrix.

Minimum Origin Version Required: Origin 9.0 SR1

What you will learn

This tutorial will show you how to:

  • Create a 3D graph from XYZ data
  • Use the Layer Contents dialog to add/remove a data plot
  • Convert XYZ data into a Matrix
  • Use the Plot Details dialog to customize a graph

Create a 3D Surface and Scatter Plot

  1. Import the file \Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat.
  2. Highlight column C and right click. Select Set As: Z from the fly-out menu.
  3. Select Plot > 3D: Surface: 3D ColorMap Surface to create a 3D Colormap Surface plot (Graph1 by default).
    Tutorial 3D Plotting01.png
  4. Right click the layer icon on the left-top of the graph to open the Layer Contents dialog. In this dialog, click on the Plot type button.png button and select 3D Scatter/Trajectory/Vector from the fly-out menu.
    Tutorial 3D Plotting02.png
  5. Select column C from the left panel and click on the Add Plot Add plot button.png button to add the 3D scatter plot to the graph. Click OK to close the dialog.
    Tutorial 3D Plotting03.png
  6. Double-click on the scatter plot of Graph1 to open the Plot Details dialog. In the Symbol tab, set Shape to Ball, Size to 12 and Color to Map: Col(C)(expand Color Chooser to do settings in the By Points sub-tab as shown below).
    Tutorial 3D Plotting04.png
  7. In the Drop Lines tab, uncheck the Parallel to Z Axis checkbox.
    Tutorial 3D Plotting05.png
  8. In the Colormap tab, click on the column header Fill... to open the dialog. In the Fill dialog, choose Load Palette, click on Select Palette, and select Rainbow from the list.
    Tutorial 3D Plotting06.png
  9. Select Layer1 from the left panel of the Plot Details dialog. In the Lighting tab, select Directional as Mode and do the settings under Light Color just as the image below showing. Click OK to close the dialog.
    Tutorial 3D Plotting07.png

    The graph should look as below:
    Tutorial 3D Plotting08.png

Press the "S" key while hovering on a 3D openGL graph. The cursor will change modes. Drag with your mouse or use arrow keys to change lighting source direction.

Smooth the 3D surface plot

If you want to create a 3D surface that is smoother than the surface plot above(created from XYZ data), you can firstly convert the XYZ data into a matrix using the XYZ Gridding tool. And then, use the result Matrix data to create the 3D surface.

  1. Activate the workbook XYZ Random Gaussian again.
  2. Select Worksheet: Convert to Matrix: XYZ Gridding to open the dialog. Expand the Gridding Settings branch, select Random (Thin Plate Spline) from the Gridding Method and Parameters drop-down list, and set both the Columns and Rows to 30. Click OK to convert the XYZ data into a matrix.
    Tutorial 3D Plotting09.png
  3. Activate the matrix, and select Plot > 3D: Surface: 3D Colormap Surface to create another 3D graph, says Graph2.
  4. Go back to Graph1, right-click on any white space in Layer frame to select Copy Format: All Style Formats in the context menu.
    Tutorial 3D Plotting11.png
  5. Switch to Graph2 again, right-click on the Layer frame, select Paste Format in the context menu.
  6. Select Format: Plot Properties... from main menu to open the Plot Details dialog. Go to Colormap/Contours tab, clear Enable Contours check box:
    Tutorial 3D Plotting12.png
    Graph2 should look as below:
    Tutorial 3D Plotting10.png
 

© OriginLab Corporation. All rights reserved.