Currently only PyGist supports QuadMeshes.
The QuadMesh class provides a means of encapsulating information about two-dimensional, quadrilateral meshes and plotting the information connected with these meshes in various ways. Information can be plotted as contour lines, filled contours, or filled cells; different regions of the mesh can be plotted with different characteristics; and vector fields can be plotted on all or part of the mesh. The keyword arguments for QuadMesh objects are:
QuadMesh, like all other 2d classes, also has methods set and new.
x and y, matching two-dimensional sequences of floating point values. These arguments are required and give the coordinates of the nodes of the mesh.
ireg, the region map: optional two-dimensional sequence of integer values with the same dimensions as x and y, giving positive region numbers for the cells of the mesh, zero where the mesh does not exist. The first row and column of ireg should be zero (although these values will be ignored), since there are one fewer cells in each direction than there are nodes.
boundary = 0/1; 0: plot entire mesh; 1: plot only the boundary of the selected region(s).
boundary_type, boundary_color: these matter only if boundary = 1, and tell how the boundary will be plotted ("solid", "dash", "dot", "dashdot", "dashdotdot", or "none") and what its color will be.
region = n: if n = 0, plot entire mesh; if any other number, plot the region specified (according to the settings in ireg).
regions = [r1, r2,...]: this option allows the user to specify to a QuadMesh a list of Region objects (see Section 3.4 "Region Objects" on page 33) to plot. Each object may have different plotting characteristics (see Section "Examples" on page 34). Only regions r1, r2, ... will be plotted.
regions = "all" (the default): plot all regions of the mesh.
inhibit = 0/1/2; 0: Plot all mesh lines. 1: Do not plot the (x [:, j], y [:, j]) lines; 2: Do not plot the (x [i,:], y[i,:]) lines; 3: If boundary = 1, do not plot boundaries. (Default: 0.) 0, 1, and 2 only apply if edges = 1.
tri, optional two-dimensional sequence of values with the same dimensions as ireg, triangulation array used for contour plotting.
z = optional two-dimensional sequence of floating point values. Has the same shape as x and y. If present, the contours of z will be plotted (default: 8 contours unless levels (see below) specifies otherwise), or a filled mesh will be plotted if filled = 1. In the latter case, z may be one smaller than x and y in each direction, and represents a zone-centered quantity.
levels = either:
(1) optional one-dimensional sequence of floating point values. If present, a list of the values of z at which you want contours; or
(2) if a single integer, represents the number of contours desired. They will be computed (at equal levels) by the graphics.
filled = 0/1: If 1, plot a filled mesh using the values of z if contours = 0, or plot filled contours if contours = 1 (this option is not available at the time of writing of this manual, but will be added soon). If z is not present, the mesh zones will be filled with the background color, which allows plotting of a wire frame. (default value: 0.)
contours = 0/1: if 1, contours will be plotted if filled = 0, and filled contours will be plotted if filled = 1 (this option is not available at the time of writing of this manual, but will be added soon). contours normally defaults to 0, but will default to 1 if edges = 0 and filled = 0.
The table below summarizes the effects of these two keywords (assuming z is present):
TABLE 3. filled and contours
contours = 0
contours = 1
edges, if nonzero, draw a solid edge around each zone. If edges = 0 and filled = 0, draw contour lines. (Default value: 0.)
ecolor, ewidth--the color and width of the mesh lines when filled = 1 and edges is nonzero.
vx, vy--optional two-dimensional sequences of floating point values. Has the same shape as x and y. If present, represents a vector field to be plotted on the mesh.
scale = floating point value. When plotting a vector field, a conversion factor from the units of (vx, vy) to the units of (x, y). If omitted, scale is chosen so that the longest vectors have a length comparable to a ``typical'' zone size.
z_scale = specifies "log", "lin", or "normal" for how z is to be plotted.
type, color, width, label, hide, and marks are as for curves.
marker is different, since you would not want to specify the same marker for all contours in a contour plot. Instead, you can use marker to designate the letter (or number) which you want to mark the lowest contour curve; then the remaining contours will be lettered or numbered consecutively from that point on.
Methods new and set are as in the Curve class. Remember the warning about set: very little error checking is done, so if you are not careful, you could assign conflicting values to keywords.
The following Python code computes a mesh and some data on the mesh to be used in the QuadMesh examples which follow. This same code will be assumed in the examples given in the next section on Regions. Note the import statements, which bring in the necessary name spaces to do the computations.
The following code plots the mesh lines in three different ways, as described in the comments:
In this example, we create a uniform 25 by 35 mesh, and do a contour plot of the values of z computed above. Then we go back to the (xr, yr) mesh used above. We use the same Graph2d object as the preceding example, deleting object 1 and then adding the new QuadMesh object each time.
Note: the Graph method change_plot changes the appearance of the existing plot; there is no need to issue another plot call. See "Description" on page 75
support@icf.llnl.gov Copyright © 1997,Regents of the University of California. All rights reserved.