| MATLAB Function Reference | ![]() |
![]()
To graph selected variables, use the Plot Selector
in the Workspace Browser,
or use the Figure Palette Plot Catalog. Manipulate graphs in plot edit mode with the Property Editor. For details,
see "Plotting
Tools — Interactive Plotting" in the MATLAB® Graphics
documentation and "Creating
Graphics from the Workspace Browser" in the MATLAB Desktop
Tools and Development Environment documentation.
contourf(Z)
contourf(Z,n)
contourf(Z,v)
contourf(X,Y,Z)
contourf(X,Y,Z,n)
contourf(X,Y,Z,v)
contourf(axes_handle,...)
C = contourf(...)
[C,h] = contourf(...)
[C,h,CF] = contourf(...)
A filled contour plot displays isolines calculated from matrix Z and fills the areas between the isolines using constant colors. The color of the filled areas depends on the current figure's colormap. NaNs in the Z-data leave white holes with black borders in the contour plot. The function creates and optionally returns a handle to a Contourgroup Properties object containing the filled contours.
contourf(Z) draws a contour plot of matrix Z, where Z is interpreted as heights with respect to a plane. Z must be at least a 2-by-2 matrix that contains at least two different values. The number of contour lines and the values of the contour lines are chosen automatically.
contourf(Z,n) draws a contour plot of matrix Z with n contour levels.
contourf(Z,v) draws a contour plot of matrix Z with contour levels at the values specified in vector v. When you use the contourf(Z,v) syntax to specify a vector of contour levels (v must increase monotonically), contour regions with Z-values less than v(1) are not filled (they are rendered in white). To fill such regions with a color, make v(1) less than or equal to the minimum Z-data value.
contourf(X,Y,Z), contourf(X,Y,Z,n), and contourf(X,Y,Z,v) produce contour plots of Z using X and Y to determine the x- and y-axis limits. When X and Y are matrices, they must be the same size as Z, in which case they specify a surface as surf does. X and Y must be monotonically increasing.
contourf(axes_handle,...) plots into the axes with the handle axes_handle instead of into the current axes (gca).
C = contourf(...) returns the contour matrix C as calculated by the function contourc and used by clabel.
[C,h] = contourf(...) also returns a handle h for the contourgroup object.
Backward-Compatible Version
[C,h,CF] = contourf(...) returns the contour matrix C as calculated by the function contourc and used by clabel, a vector of handles h to patch graphics objects (instead of a contourgroup object, for compatibility with MATLAB Version 6.5 and earlier) and a contour matrix CF for the filled areas.
Note The v6 option enables users of MATLAB Version 7.x to create FIG-files that previous versions can open. It is obsolete and will be removed in a future version of MATLAB. |
See Plot Objects and Backward Compatibility for more information.
If X or Y is irregularly spaced, contourf calculates contours using a regularly spaced contour grid, and then transforms the data to X or Y.
Create a filled contour plot of the peaks function.
[C,h] = contourf(peaks(20),10); colormap autumn

clabel, contour, contour3, contourc, quiver
Contour Plots for related functions
![]() | contourc | Contourgroup Properties | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |