C-PLOT

Scientific Graphics and Data Analysis

C.4. - contour.4



The contour.4 user function generates contour plots.
fn contour.4  [options]
Valid options are:

 .   :   use same options as last time 
 +g or -g   :   data are (or aren't) a perfect grid 
 +n or -n   :   data are (or aren't) a near grid 
 +s or -s   :   data are (or aren't) properly sorted 
 +r or -r   :   reuse (or don't) previous data 
 +v or -v   :   show (or don't) function progress 
 #   :   number of contour intervals (default 10) 
 zmin=#   :   z value of first contour 
 zmax=#   :   z value of last contour 
 xcol=#   :   number of columns of data 
 xmin=#   :   use this value to window x data 
 xmax=#   :   use this value to window x data 
 ymin=#   :   use this value to window y data 
 ymax=#   :   use this value to window y data 

The default options are: +gsv -r 10.

The default minimum and maximum of x, y and z are the data minimum and maximum. In the default case, the number of columns of data is estimated automatically. In 2D mode the z values are taken from the x-error-bar column. The numbers returned can be plotted in 2D or 3D mode.

By indicating the data are a "perfect" or "near" grid and/or "properly" sorted, you can save time otherwise used in unnecessary preprocessing of the data.

A perfect grid means that if there are N columns and M rows, the total number of points is N times M. In addition, the x and y values each need to be equally spaced. In the current version of contour.4, a different algorithm is used for data in a perfect grid than for the other case. The perfect-grid algorithm returns smoother contours than does the alternate algorithm. Also, the data points for each contour are in consecutive order, so that they may be plotted with patterned lines. With the alternate algorithm, the data points are returned as line segments that form columns on the page.

A near grid requires the x data to be in columns, although not all columns must have the same number of points.


Properly sorted data means the data are sorted by increasing values of x. Data with the same x values are sorted by increasing values of y. If x values within a given column of data are not identical, data points within that column must be sorted by y, with the sort by y taking priority over the sort by x.

If the data are a grid, the function determines the number of columns from the number of points in the first column, which ends when the y values first turn over. If the data are not a grid but are sorted, or if the data are a "near" grid, the function counts the number of columns by counting the number of times the y values turn over.

If the data are not a grid and are not presorted, and if you don't specify the number of columns of data, the function estimates that number using the following rules:

After the function sorts the data by x, it counts the number of times the y values turn over. If this number is less than the maximum number of columns (1024) and less than one-third the number of points, that value is used. Otherwise, the number of columns is simply set to the square root of the number of points rounded to the nearest integer.

The contour.4 function will produce an approximation of a contour plot even if the input data are randomly scattered over the x-y plane.

In 3D mode, contour.4 returns new x, y and z values. In 2D mode, the contour (or z values) are returned in the x-error bar column. One could use various UNIX utilities to extract data points along the same contour, place them into separate files, read them back and plot them with unique symbols or pen colors.

Reusing the previous data can save time if you are interested in generating different contour ranges or intervals with the same data set. Only changes to the contour minimum, maximum or number of contour intervals have any effect with the reuse option.

Entering a negative number for the number of contour intervals selects logarithmic contour spacing. The minimum and maximum contour values selected must, of course, be positive numbers.