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.
- Start with the project saved from the previous lesson and add a new folder named 3D and Contour. Click to open the empty folder.
- Click the New Workbook button on the Standard toolbar.
- Import the file <Origin EXE Path>\Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat.
- Right-click on the header of column C and select Set as: Z from the context menu.
- Keep column C highlighted. Then select the menu Plot > 3D: 3D Color Map Surface to create a surface plot.
- 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.
- 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 to add the plot to the right-hand panel.
- Click OK to close the dialog. The graph will now display the individual data points on the surface.
- Hold the R key and use the mouse to freely rotate the surface plot.
- Click on the New Matrix button in the Standard toolbar to open a new matrix window.
- 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.
- With the matrix active, select the menu Plot > Contour: Image Profiles. An image profile graph will be created, and the Image/Contour Profile dialog will open.
- In the dialog, select the HLine tab then make the horizontal line thicker by expanding the Width branch and changing Pixels to 50.
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
- Click on the New Workbook button to create a new workbook.
- Click on the Import Wizard button . In the dialog that opens, choose the ... button next to File box, browse to <Origin EXE Path>\Samples\Graphing folder, choose waterfall.dat file. Click Finish to import the file.
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.
- 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.
- Select menu Plot > 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.
- Change Y Values in to Column Label, and then set Column Label to Excitation Wavelength(nm).
- Click the OK button to apply the settings and create the contour graph.
- Click the Enable/Disable Speed Mode button one time from the right-hand toolbar, to turn off the speed mode setting for the graph.
- Go back to the workbook with waterfall data. Keep the whole worksheet highlighted and this time select the menu Plot > 3D: 3D Color Map Surface with Projection.
- 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.
- 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.
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.
- 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
- Select the menu File: New: Function Plot: 3D Function Plot.
- In the dialog box, click the triangle button next to the Theme box on the top. Then select Mexican Hat(System) in the context menu to load the settings for this example.
- Press OK to create the plot.
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.