1.6 3D and Contour


In this lesson we will learn how to plot 3D, contour, and profile plots. Data for such plots can be organized as XYZ columns or an array of cells in a worksheet, or in a matrix window.

3D Surface

  1. Start with the project saved from the previous lesson and add a new folder named 3D and Contour. Click to open the empty folder.
  2. Click the New Workbook Button New Workbook.png button on the Standard toolbar.
  3. Import the file <Origin EXE Path>\Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat.
  4. Right-click on the header of column C and select Set as: Z from the context menu.
  5. Keep column C highlighted. Then select the menu Plot > 3D: Surface: 3D Color Map Surface to create a surface plot.
  6. Double-click on the layer icon on the upper left corner of the graph page, indicated by 1, to open the Layer Contents dialog box.
  7. In the left-hand panel, select C(Z). In the middle section, click the drop-down arrow next to the A button. From the drop-down, select 3D Scatter/Trajectory/Vector. Click the Add Plot button Button Add plot.png to add the plot to the right-hand panel.
    GST surface contour 02.png
  8. Click OK to close the dialog. The graph will now display the individual data points on the surface.
  9. Hold the R key and use the mouse to freely rotate the surface plot.

Image Profile

  1. Click on the New Matrix button Button New Matrix.png in the Standard toolbar to open a new matrix window.
  2. Select the menu Data: Import from File: Image to Matrix, then browse to <Origin EXE Path>\Samples\Image Processing and Analysis folder and select cell.jpg file and import it into the matrix.
  3. With the matrix active, select the menu Plot > 2D: Profile: Image Profiles. An image profile graph will be created, and the Image/Contour Profile dialog will open.
  4. In the dialog, select the HLine tab then make the horizontal line thicker by expanding the Width branch and changing Pixels to 50.
  5. You can add multiple horizontal, vertical, or arbitrary lines using the buttons in the dialog. The graph layers will display overlaid curves for the profiles in the appropriate layers. Profile plots can also be made from data in a matrix or worksheet.

Contour and Surface Plots from Virtual Matrix

  1. Click on the New Workbook button Button New Workbook.png to create a new workbook.
  2. Click on the Import Wizard button Button Import Wizard.png. In the dialog that opens, choose the ... button Button dot dot dot.png next to File box, browse to <Origin EXE Path>\Samples\Graphing folder, choose waterfall.dat file. Click Finish to import the file.
    GST surface contour 05.png
  3. The Import Wizard can be used to parse an ASCII file to extract variables from header lines. The file you chose already has a predefined filter which is applied when you click the Finish button.

  4. Move the cursor to the upper left corner of the workbook until the shape of the pointer changes as in the following image, and click to select all columns of the worksheet.
    GST surface contour 06.png
  5. Select menu Plot > 2D: Contour: Contour - Color Fill. This will open the plotvm dialog box, where you need to specify the data organization for your Virtual Matrix, as the data is contained in a worksheet instead of a matrix window.
  6. Change Y Values in to Column Label, and then set Column Label to Excitation Wavelength(nm).
  7. Click the OK button to apply the settings and create the contour graph.
  8. Click the Enable/Disable Speed Mode button Button Speedmode.png one time from the right-hand toolbar, to turn off the speed mode setting for the graph.
  9. Go back to the workbook with waterfall data. Keep the whole worksheet highlighted and this time select the menu Plot > 3D: Surface: 3D Color Map Surface with Projection.
  10. The plotvm dialog opens. Note that the Theme box on the top of dialog is set as <sheet>. This is because the settings used last time were saved in the worksheet. Click OK to accept the same settings. A surface graph with contour projection will be created.
  11. Double-click on the contour projection to open the Plot Details dialog. Note that on the Surface tab, the Flat check box is checked, and an offset of 100% has been applied. This setting makes the data plot appear as a flat contour on top of the cube. Click OK to close Plot Details.
    GST surface contour 08.png
  12. Data from different matrices or virtual matrices can be plotted in the same 3D graph layer by specifying an appropriate offset value for each, and further specifying which datasets to flatten. This allows to examine related data together in the same graph.

  13. Double click on the Z axis to open the Axis dialog. Switch to the Scale tab and set the To value to 4000 and click OK. This allows better viewing of the 3D surface. The contour project will stay on the top plane of the cube.

3D Function Plot

  1. Select the menu File: New: Function Plot: 3D Function Plot.
  2. In the dialog box, click the triangle button Triangle button.png next to the Theme box on the top. Then select Mexican Hat(System) in the context menu to load the settings for this example.
  3. Press OK to create the plot.
  4. A parametric function can be added to an existing graph, thus allowing you to combine such plots with real data. Visit 3D Function Gallery to view and download more examples.

Save your project file.