You are a guest. Restricted access. Read more


You can plot 3D surface plots (in case of functions) or show data points in 3D using plot3D method. The plots are fully interactive and one can rotate and zoom-in particular regions.

First, let us create a canvas and prepare for plotting of data in 3D.


There are several methods associated with it: clear3d (clear the canvas from data) and expert3d(file), to export the plot to the vector format image, such as PDF, EPS, as well as PNG and JPG. You can also put title, label and change the minimum and maximum ranges for X-axis and Y-axis. You can pass the following options to this canvas:

This box indicates that you are not a full member and cannot access this part of the documentation.

Plotting functions in 3D

Functions can be shown as surface plots in 3D. You will need to define symbolic variables x and y, and then construct symbolic function. The pass it to the method draw3d: Run this example to find how it works. It will show a pop-up canvas with a surface plot in 3D:

syms x,y

Alternatively, one can pass a string which specifies a function using “x” and “y” as variables. Run this example to see how it works:


This generates interactive surface plot in 3D. The ranges of X,Y,Z can be specified as option for the method plot3d.

Plotting data in 3D

Data may be graphed using the plot3d function as well. In this case you need to pass 3 vectors

Let as show a simple example of plotting sin(x) between 0 and 10 with a step 0.1

x=0:0.3:10; y=sin(x); z=cos(x); 

Note that it is convenient to set X,Y,Z ranges during the canvas creating step, in this case the axis labels will be nicely formatted (unlike the example above).

Exporting plots to images

To clear the plot, use “clear3d” method. One can export the plot in PDF, EPS, PS, PNG, JPG image formats using the method export3d(file) method. For example, export3d(“image.eps”) will export the graph to EPS/PS format using high-quality vector graphics.

Drawing options

You can pass the following options to the “draw3d” method:

This box indicates that you are not a full member and cannot access this part of the documentation.

jmathlab/plotting/plot3d.txt · Last modified: 2015/05/10 17:18 (external edit)
Back to top
CC Attribution-Share Alike 3.0 Unported = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0