8.6.1 Two-dimensional parametric surfacesPyxplot can also plot datasets which can be parameterised in terms of two free parameters As in the case of parametric lines above, the range of values that each free parameter should take must be specified. This can be done using the set urange and set vrange commands. These commands also act to switch Pyxplot between one- and two-dimensional parametric function evaluation; whilst the set trange command indicates that the next parametric function should be evaluated along a single raster of values of The number of samples to be taken can be specified using a command of the form set sample grid 20x50 which specifies that 20 different values of set num err quiet ![]() The ranges of values to use for plot parametric [0:1][0:1] u:v , \ parametric [0:1] sin(t):cos(t) Example: A three-dimensional view of a torus In this example we plot a torus, which can be parametrised in terms of two free parameters ![]() ![]()
![]() ![]() ![]() ![]() ![]() R = 3 r = 0.5 f(u,v) = (R+r*cos(v))*cos(u) g(u,v) = (R+r*cos(v))*sin(u) h(u,v) = r*sin(v) set urange [0:2*pi] set vrange [0:2*pi] set zrange [-2.5:2.5] set nokey set size 8 square set grid set sample grid 50x20 plot 3d parametric f(u,v):g(u,v):h(u,v) with surf fillcol blue ![]() Example: A three-dimensional view of a trefoil knot
In this example we plot a trefoil knot, which is the simplest non-trivial knot in topology. Simply put, this means that it is not possible to untie the knot without cutting it. The knot follows the line
![]() ![]() ![]() ![]() ![]() ![]() r = 5 R = 2 f(u,v) = cos(2*u)*cos(v) + r*cos(2*u)*(1.5+sin(3*u)/2) g(u,v) = sin(2*u)*cos(v) + r*sin(2*u)*(1.5+sin(3*u)/2) h(u,v) = sin(v)+R*cos(3*u) set urange [0:2*pi] set vrange [-pi:pi] set nokey set size 8 square set grid set sample grid 150x20 plot 3d parametric f(u,v):g(u,v):h(u,v) with surf fillcol blue ![]()
|