Contour and Shade Plots
Prev | Chapter 3. Advanced Use of PLplot | Next

## Contour and Shade Plots

Several routines are available in PLplot which perform a contour or shade plot of data stored in a two-dimensional array. The contourer uses a contour following algorithm so that it is possible to use non-continuous line styles. Further, one may specify arbitrary coordinate mappings from array indices to world coordinates, such as for contours in a polar coordinate system. In this case it is best to draw the distinction between the C and Fortran 95 interfaces so these are handled in turn.

### Contour Plots from C

`plcont` is the routine callable from C for plotting contours. This routine has the form:

`plcont (` | z,
| nx,
| ny,
| kx,
| lx,
| ky,
| ly,
| clevel,
| nlevel,
| pltr,
| pltr_data`)`;

where `z` is the two-dimensional array of size `nx` by `ny` containing samples of the function to be contoured. (`z` is a vectored two-dimensional array as described in the previous section. It is not a fixed-size two-dimensional array.) The parameters `kx`, `lx`, `ky` and `ly` specify the portion of `z` that is to be considered. The array `clevel` of length `nlevel` is a list of the desired contour levels.

The path of each contour is initially computed in terms of the values of the array indices which range from `0` to `nx-1` in the first index and from `0` to `ny-1` in the second index. Before these can be drawn in the current window (see the section called “Defining the Window”), it is necessary to convert from these array indices into world coordinates. This is done by passing a pointer `pltr` to a user-defined transformation function to `plcont`. For C use of `plcont` (and `plshade`, see next subsection) we have included directly in the PLplot library the following transformation routines: `pltr0` (identity transformation or you can enter a NULL argument to get the same effect); `pltr1` (linear interpolation in singly dimensioned coordinate arrays); and `pltr2` (linear interpolation in doubly dimensioned coordinate arrays). Examples of the use of these transformation routines are given in `examples/c/x09c.c`, `examples/c/x14c.c`, and `examples/c/x16c.c`. These same three examples also demonstrate a user-defined transformation function `mypltr` which is capable of arbitrary translation, rotation, and/or shear. By defining other transformation subroutines, it is possible to draw contours wrapped around polar grids etc.

### Shade Plots from C

NEEDS DOCUMENTATION. Follow the plshade and plshades usage in `examples/c/x??c.c`.

### Contour Plots from the Fortran 95 interface

NEEDS DOCUMENTATION. Follow the plcont usage (with a variety of overloaded forms available with different arguments) in `examples/f95/x??f.f90`.

### Shade Plots from the Fortran 95 interface

NEEDS DOCUMENTATION. Follow the plshade and plshades usage (with a variety of overloaded forms available with different arguments) in `examples/f95/x??f.f90`.

Prev | Up | Next
Three Dimensional Surface Plots | Home | Legends and color bars