Back to main page
Back to draw contents
This section shows how to draw contours in 3d.
In this case, contour lines are added in the xy-plane. Two screen captures follow.
draw3d(color = green,
explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
yv_grid = 10,
color = red,
explicit(x+y,x,0,2,y,-5,5),
contour_levels = 15,
contour = base,
surface_hide = true) ;
![]() |
![]() |
More contours.
draw3d(color = green,
explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
contour_levels = 15,
contour = both,
surface_hide = true) ;
Even more contours.
draw3d(terminal = eps_color,
title = "This is the last contours example",
explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
contour_levels = 15,
contour = map,
surface_hide = true) ;
Absolute value of the gamma function.
gamma2(x,y):=
block([re,im,g:gamma(x+%i*y)],
re:realpart(g),
im:imagpart(g),
sqrt(re^2+im^2))$
draw3d(zrange=[0,6],
xu_grid = 50,
yv_grid = 50,
surface_hide = true,
contour = surface,
contour_levels = [0,0.5,6], /* from 0 to 6 in steps of 0.5 */
color = cyan,
/* uncomment next line if you want an eps file */
/*terminal = eps_color,*/
explicit(gamma2(x,y),x,-4,4,y,-2,2));
Absolute value of the polynomic function z3+1 with enhanced color and contours.
z3(x,y):= abs((x+y*%i)^3+1)$
draw3d(surface_hide =true,
color = green,
contour = both,
enhanced3d=true,
explicit(z3(x,y),x,-10,10,y,-10,10) );
It is possible to fix the number of isolines setting option contour_levels to a positive integer number. The actual number of levels can be adjusted to give simple labels, as in this example.
draw3d( surface_hide = true, color = green, explicit(exp(-x^2-y^2),x,-2,2,y,-2,2), contour = surface, contour_levels = 3);
Declare increments to isolines setting contour_levels to a list of the form [init, incr, end].
draw3d( surface_hide = true, color = green, explicit(exp(-x^2-y^2),x,-2,2,y,-2,2), contour = surface, contour_levels = [0.1,0.1,1]);
It is also possible to select a certain number of fixed levels setting contour_levels to a set of numbers.
draw3d(
surface_hide = true,
color = green,
explicit(exp(-x^2-y^2),x,-2,2,y,-2,2),
contour = surface,
contour_levels = {0.1,0.7,0.8});
Back to main page
Back to draw contents