[Top] [Prev] [Next] [Bottom]

7.6 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 ith entry of which gives the number of vertices of the ith polygonal cell; xyzverts are the vertices of the coordinatesof the cells, with each consecutive nv [i] entries representing the vertices of the ith 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 7.4.2 "slice3: Plane and Isosurface Slices of a 3-D mesh" on page 65). plzcont and pl4cont actually do repeated calls to slice2x (see Section 7.4.3 "slice2 and slice2x: Slicing Surfaces with planes" on page 66) 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)

The resulting graph is shown on the next page.



[Top] [Prev] [Next] [Bottom]

support@icf.llnl.gov
Copyright © 1997,Regents of the University of California. All rights reserved.