contourf
Draws filled contour plots.
Category: Graphics > 2-D and 3-D Plots
Syntax
contourf(Z)
Filled contours of the matrix Z.
contourf(X, Y, Z)
Uses the coordinates X and Y.
contourf(___, levels)
Sets the number of levels or the level values.
[C, h] = contourf(___)
Also returns the contour matrix and the contour object.
Description
The region between two neighboring levels gets one flat color taken from the colormap, so the plot works like a heat map with a limited number of bands. Add colorbar to read the values, and clabel to label the boundaries.
Input arguments
Z- Matrix of values.
X, Y- Grid coordinates.
levels- Number of levels or vector of level values.
Output arguments
C- Contour matrix, see
contourc. h- The
Contourobject.
Example
Filled bands
[X, Y, Z] = peaks(40);
contourf(X, Y, Z, 8)
colorbar
In the app, the figure is drawn below the code.