Next: , Previous: output, Up: set-show


3.24.50 parametric

The `set parametric` command changes the meaning of `plot` (`splot`) from normal functions to parametric functions. The command `unset parametric` restores the plotting style to normal, single-valued expression plotting.

Syntax:

           set parametric
           unset parametric
           show parametric
     

For 2D plotting, a parametric function is determined by a pair of parametric functions operating on a parameter. An example of a 2D parametric function would be `plot sin(t),cos(t)`, which draws a circle (if the aspect ratio is set correctly—see size). `gnuplot` will display an error message if both functions are not provided for a parametric `plot`.

For 3D plotting, the surface is described as x=f(u,v), y=g(u,v), z=h(u,v). Therefore a triplet of functions is required. An example of a 3D parametric function would be `cos(u)*cos(v),cos(u)*sin(v),sin(u)`, which draws a sphere. `gnuplot` will display an error message if all three functions are not provided for a parametric `splot`.

The total set of possible plots is a superset of the simple f(x) style plots, since the two functions can describe the x and y values to be computed separately. In fact, plots of the type t,f(t) are equivalent to those produced with f(x) because the x values are computed using the identity function. Similarly, 3D plots of the type u,v,f(u,v) are equivalent to f(x,y).

Note that the order the parametric functions are specified is xfunction, yfunction (and zfunction) and that each operates over the common parametric domain.

Also, the `set parametric` function implies a new range of values. Whereas the normal f(x) and f(x,y) style plotting assume an xrange and yrange (and zrange), the parametric mode additionally specifies a trange, urange, and vrange. These ranges may be set directly with trange, urange, and vrange, or by specifying the range on the `plot` or `splot` commands. Currently the default range for these parametric variables is [-5:5]. Setting the ranges to something more meaningful is expected.