pcolor

Pseudocolor plot: a flat grid of colored cells whose colors come from a matrix.

Category: Graphics > 2-D and 3-D Plots

Syntax

pcolor(C)

Colors the grid by the values of C, using the current colormap.

pcolor(X, Y, C)

Places the grid vertices at the coordinates X and Y.

h = pcolor(___)

Also returns the surface handle.

Description

pcolor is a flat surface seen from above. The value C(i,j) is the color at the vertex (i,j), and the last row and column of C are not drawn as cells, because a cell needs four corners. For that reason the picture has one cell fewer in each direction than C has elements.

Use shading interp for a smooth blend and shading flat for uniform cells. imagesc draws every element as a cell instead.

Input arguments

C
Matrix of values; each cell takes its color from them.
X, Y
Vertex coordinates, as matrices or vectors.

Output arguments

h
Handle to the surface object.

Example

Smooth pseudocolor

[X, Y, Z] = peaks(30);
pcolor(X, Y, Z)
shading interp
colorbar

In the app, the figure is drawn below the code.

See also

imagesc surf contourf shading heatmap