# 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 on the Standard toolbar.
3. Select menu Data: Connect to File: Text/CSV. Browse to select the file <Origin EXE Path>\Samples\Matrix Conversion and Gridding\XYZ Random Gaussian.dat. Import it with default settings.
4. Click on the header of column C and select Set as: Z button from the pop-up mini toolbar.
5. Keep column C highlighted. Then select the menu Plot > 3D: 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 to add the plot to the right-hand panel.
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 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 > Contour: Image Profiles. Click Yes in the prompted message dialog. 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 to create a new workbook.
2. 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.
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.
5. 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.
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. 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.
9. 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.
10. 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.
11.  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.
12. 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 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.