Graphics Previous page   Next Page

Drawing a Single Contour Line at a Desired Level

The contouring functions permit you to specify the number of contour levels or the particular contour levels to draw. In the case of contour, the two forms of the function are contour(Z,n) and contour(Z,v). Z is the data matrix, n is the number of contour lines, and v is a vector of specific contour levels.

MATLAB does not differentiate between a scalar and a one-element vector. So, if v is a one-element vector specifying a single contour at that level, contour interprets it as the number of contour lines, not the contour level. Consequently, contour(Z,v) behaves in the same manner as contour(Z,n).

To display a single contour line, define v as a two-element vector with both elements equal to the desired contour level. For example, create a 3-D contour of the peaks function.

To display only one contour level at Z = 1, define v as [1 1].


Previous page  Filled Contours The Contouring Algorithm Next page

© 1994-2005 The MathWorks, Inc.