Main Content

Contour plot of matrix

`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 column and row 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.