Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Contour plot of matrix

`contour(Z)`

`contour(X,Y,Z)`

`contour(___,levels)`

`contour(___,LineSpec)`

`contour(___,Name,Value)`

`contour(ax,___)`

`M = contour(___)`

`[M,c] = contour(___)`

`contour(`

creates a contour plot containing
the isolines of matrix `Z`

)`Z`

, where `Z`

contains height
values on the *x*-*y* plane. MATLAB^{®} automatically selects the contour lines to display. The row and column indices
of `Z`

are the *x* and *y* coordinates
in the plane, respectively.

`contour(___,`

specifies the
contour lines to display as the last argument in any of the previous syntaxes. Specify
`levels`

)`levels`

as a scalar value `n`

to display the contour
lines at `n`

automatically chosen levels (heights). To draw the contour
lines at specific heights, specify `levels`

as a vector of monotonically
increasing values. To draw the contours at one height (`k`

), specify
`levels`

as a two-element row vector `[k k]`

.

`contour(___,`

specifies
additional options for the contour plot using one or more name-value pair arguments. Specify
the options after all other input arguments. For a list of properties, see Contour Properties.`Name,Value`

)

`contour(`

displays the
contour plot in the target axes. Specify the axes as the first argument in any of the
previous syntaxes.`ax`

,___)

returns the
contour matrix `M`

= contour(___)`M`

, which contains the (*x*,
*y*) coordinates of the vertices at each level.