Plotting surfaces

This section describes dynagraph's plot3d() command for plotting surfaces. Dynagraph's concept of a surface is a two-dimensional rectangular grid of points mapped into the three-dimensional space.

A surface may be displayed as a solid surface (shown with or without its grid,) only the grid (optionally with hidden lines removed), contour lines representing the surface (shown with or without the surface) or just the grid points.

Plotting a single function in the Cartesian coordinates

    plot3d(z, x=a..b, y=c..d);          # a function plot
    plot3d([f,g,h], s=a..b, t=c..d);    # a parametric plot

    Arguments:
       z       : an expression in x and y
       f, g, h : expressions in s and t

Numerous optional arguments can modify the default appearance of the surface. These are described in Plotting Options.

Remark: The commands plot() and plot3d() are synonymous in dynagraph and can be used interchangeably. Plot3d() exits in dynagraph only for compatibility with Maple.

Examples:

    > plot3d(x^2+y^2, x=-1..1, y=-1..1);
    > plot3d([cos(t)*cos(s), cos(t)*sin(s), sin(t)], t=0..2*Pi, s=0..Pi/2);
    > plot3d([(2+cos(s))*cos(t), (2+cos(s))*sin(t), sin(s)],
         t=0..2*Pi, s=0..2*Pi, grid=[40,20]);

Plotting multiple functions simultaneously

    plot3d({z1,z2,...,zn}, x=a..b, y=c..d);
    plot3d({[f1,g1,h1],[f2,g2,h2],...,[fn,gn,hn]}, s=a..b, t=c..d);
plots the n graphs together. Despite what is shown above, the arguments enclosed in the curly braces {...} can be a mix of parametric and function representations, as the second example below shows.

Examples:

    > plot3d({x^2+y^2, x^2-y^2}, x=-1..1, y=-1..1);
    > plot3d({x^2+y^2, [x^2-y^2, x^2+y^2, x*y]}, x=-1..1, y=-1..1);

Variable ranges

In all instances described above, the bounds in the first range can depend on the variable of the second range, as in
    > plot3d(x^2+y^2, x=-1..2*y^2-1, y=-1..1);

The bounds in the second range, however, must evaluate to constants.

Back to table of contents