contour(x,y,vals,level [,checkargs] [,keyword phrases]), REAL vectors x, y, REAL scalar level, all with no MISSING, REAL matrix vals, optional LOGICAL scalar checkargs |

contour(x,y,vals,level) determines coordinates of a polygonal curve (curve made up of line segments) that approximates a contour of constant height of a surface whose height at (x[i], y[i]) is vals[i,j]. x and y must be REAL vectors of unique non-MISSING values. vals must be a REAL nrows(x) by nrows(y) matrix, which may have MISSING elements. level must be a non-MISSING REAL scalar, preferably between the extreme values in vals. Most commonly, vals[i,j] = F(x[i],y[j]) for some function F(x,y) of two variables. When the surface is not defined or is infinite at (x[i],y[j]), vals[i,j] should be MISSING. contour(x,y,vals,levels,T) does the same, except that the arguments are not checked for correctness. In particular, x and y are assumed to be increasing order, which is not ordinarily required. This usage is designed for use in macro contourplot() which has already checked arguments and reordered x and y before calling contour(). The value returned is structure(x:xc, y:yc, level:level). When level is outside the range of vals, xc and yc are both NULL. Otherwise xc and yc are REAL vectors of the same length. The points (xc[k],yc[k]), k = 1,..., nrows(xc), are either intersections of the contour with gridlines, or (MISSING,MISSING). When a contour consists of two or more disjoint curves, they are separated by MISSING in both xc and yc. contour(x,y,vals,level, graphics keyword phrases) does the same except the result is structure(x:xc, y:yc, level:level, graphics keyword phrases) in which all the keyword phrases in the argument are appended to the result. Example: Cmd> curve <- contour(x,y,vals,level,title:"Sample contour curve") Cmd> if(!isnull(curve$x)){ lineplot(keys:curve) } During execution of contour(), x, y and vals are copied to invisible arrays __X__, __Y__ and __F__, respectively and macro _Follow() traces out the contour, keeping status information in invisible matrix __MET__. __X__, __Y__, __F__ and __MET__ are deleted before contour() is finished. See also contourplot().

Gary Oehlert 2003-01-15