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.

Filled 2-D contour plot

`contourf(Z)`

`contourf(X,Y,Z)`

`contourf(___,levels)`

`contourf(___,LineSpec)`

`contourf(___,Name,Value)`

`contourf(ax,___)`

`M = contourf(___)`

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

`contourf(`

creates a filled 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.

`contourf(___,`

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]`

.

`contourf(___,`

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`

)

`contourf(`

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`

= contourf(___)`M`

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