Next: Manipulating Existing Plots, Previous: Specialized Two-Dimensional Plots, Up: Plotting
This function produces three-dimensional plots. Many different combinations of arguments are possible. The simplest form is
plot3 (x, y, z)where the arguments are taken to be the vertices of the points to be plotted in three dimensions. If all arguments are vectors of the same length, then a single continuous line is drawn. If all arguments are matrices, then each column of the matrices is treated as a seperate line. No attempt is made to transpose the arguments to make the number of rows match.
Additionally, only two arguments can be given as
plot3 (x, c)where the real and imaginary parts of the second argument are used as the y and z coordinates, respectively.
If only one argument is given, as
plot3 (c)the real and imaginary parts of the argument are used as the y and z values, and they are plotted versus their index.
To save a plot, in one of several image formats such as PostScript or PNG, use the
See
__pltopt__
for a description of the optional format argument.Arguments can also be given in groups of three as
plot3 (x1, y1, z1, x2, y2, z2, ...)where each set of three arguments is treated as a seperate line or set of lines in three dimensions.
To plot multiple one- or two-argument groups, separate each group with an empty format string, as
plot3 (x1, c1, '', c2, '', ...)An example of the use of plot3 is
z = [0:0.05:5]; plot3(cos(2*pi*z), sin(2*pi*z), z, ";helix;"); plot3(z, exp(2i*pi*z), ";complex sinusoid;");See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, __pltopt__ bar, stairs, errorbar, xlabel, ylabel, title, print.
Plot a mesh given matrices x, and y from
meshgrid
and a matrix z corresponding to the x and y coordinates of the mesh. If x and y are vectors, then a typical vertex is (x(j), y(i), z(i,j)). Thus, columns of z correspond to different x values and rows of z correspond to different y values.See also: meshgrid, contour.
Given vectors of x and y and z coordinates, and returning 3 arguments, return three dimensional arrays corresponding to the x, y, and z coordinates of a mesh. When returning only 2 arguments, return matrices corresponding to the x and y coordinates of a mesh. The rows of xx are copies of x, and the columns of yy are copies of y. If y is omitted, then it is assumed to be the same as x, and z is assumed the same as y.
See also: mesh, contour.
Given n vectors x1, ... xn, ndgrid returns n arrays of dimension n. The elements of the ith output argument contains the elements of the vector xi repeated over all dimensions different from the ith dimension. Calling ndgrid with only one input argument x is equivalent of calling ndgrid with all n input arguments equal to x:
[y1, y2, ..., yn] = ndgrid (x, ..., x)
See also: meshgrid.