next up previous contents index
Next: Animation: movie and spin3 Up: Three-Dimensional Plotting Functions Previous: pl3tree: add a surface   Contents   Index


Contour Plotting on Surfaces: plzcont and pl4cont

Contour lines can be plotted on a surface, or filled contours can be drawn, or both, by means of the two functions plzcont (plot z contours, i. e., contours according to height in the z direction) and pl4cont (plot 4D contours, i. e., contours determined by some other function defined on the surface.

Calling Sequences
...
 
plzcont (nverts, xyzverts, contours = 8, scale = "lin", 
clear = 1, edges = 0, color = None, cmin = None, 
cmax = None, zaxis_min = None, zaxis_max = 0, split = 0) 
pl4cont (nverts, xyzverts, values, contours = 8, scale = 
"lin", clear = 1, edges = 0, color = None, cmin = None, 
cmax = None, caxis_min = None, caxis_max = 0, split = 0)

Description
plzcont plots z contours, and pl4cont plots contours derived from the function values. nverts and xyzverts specify the polygons which define the surface. nverts is an array of integers,

the i th entry of which gives the number of vertices of the i th polygonal cell; xyzverts are the vertices of the coordinates of the cells, with each consecutive nv [i] entries representing the vertices

of the i-th cell; and values (for pl4cont) being a set of values, one for each vertex. These arguments are the same format as returned by slice3 and slice3mesh ( see Section ``slice3: Plane and Isosurface Slices of a 3D mesh'' on page [*]). plzcont and pl4cont actually do repeated calls to slice2x (see Section ``slice2 and slice2x: Slicing Surfaces with planes'' on page [*]) in order to obtain the contour curves.

Keyword Arguments

contours
can be one of the following: N, an integer: Plot N contours (therefore, N+ 1 colored components of the surface) CVALS, a vector of floats: draw the contours at the specified levels.

scale
can be "lin", "log", or "normal" specifying the contour scale. (Only applicable if contours = N, of course).

clear
If clear == 1, clear the display list first. Otherwise the current contour plot will be added to the display list.

edges
If edges == 1, plot the edges.

color
If color == None, then bytscl the palette into N + 1 colors and send each of the slices to pl3tree with the appropriate color. If color=="bg", will plot only the edges. See also split (below).

cmin, cmax
If cmin is given, use it instead of the minimum c actually being plotted in the computation of contour levels. If cmax is given, use it instead of the maximum c actually being plotted in the computation of contour levels. This is done so that a component of a larger graph will have the same colors at the same levels as every other component, rather than its levels being based on its own maximum and minimum, which may lie inside or outside those of the rest of the graph.

zaxis_min, zaxis_max
zaxis_min and zaxis_max represent axis limits on z as expressed by the user. If present, zaxis_min will inhibit plotting of all lesser z values, and zaxis_max will inhibit the plotting of all greater z values.

caxis_min, caxis_max
caxis_min and caxis_max represent axis limits on c as expressed by the user. If present, caxis_min will inhibit plotting of all lesser c values, and caxis_max will inhibit the plotting of all greater c values.

split
If split == 1, then it is intended to plot this portion of the graph as if the palette has been split, so only colors 0-99 will be used to color the contours. If split == 0, then all colors from 0 to 199 will be used.

Example
In the following example, we compute the sombrero function and then use plzcont to draw it with contours in "normal" scale. In "normal" scale, the top and bottom contours are two standard deviations away from the mean. Thus the peak of the sombrero is all the same color because its few points contribute very little to the standard deviation.

# compute sombrero function 
x = arange (-20, 21, typecode = Float) 
y = arange (-20, 21, typecode = Float) 
z = zeros ( (41, 41), Float) 
r = sqrt (add. outer ( x ** 2, y ** 2)) + 1e-6 
z = sin (r) / r 
fma () 
clear3 () 
gnomon (0) 
# Make sure we don't draw till ready 
set_draw3_(0) 
palette (" rainbow. gp") 
[nv, xyzv, dum] = slice3mesh (x, y, z) 
plzcont (nv, xyzv, contours = 20, scale = "normal") 
[xmin, xmax, ymin, ymax] = draw3 (1) 
limits (xmin, xmax, ymin, ymax)

To draw the same function in "lin" scale, with edges visible, enter the following code:

plzcont (nv, xyzv, contours = 20, scale = "lin", edges= 1) 
[xmin, xmax, ymin, ymax] = draw3 (1) 
limits (xmin, xmax, ymin, ymax)


next up previous contents index
Next: Animation: movie and spin3 Up: Three-Dimensional Plotting Functions Previous: pl3tree: add a surface   Contents   Index
Michiel Jan Laurens de Hoon 2003-04-19