Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

pcolor

Pseudocolor plot.

Syntax

  • pcolor(C)
  • pcolor(X, Y, C)
  • pcolor(parent, ...)
  • go = pcolor(...)

Input argument

  • X - x-coordinates: vector or matrix.
  • Y - y-coordinates: vector or matrix.
  • C - Color array: m-by-n-by-3 array of RGB triplets.
  • parent - a scalar graphics object value: parent container, specified as a axes.

Output argument

  • go - a graphics object: surface type.

Description

pcolor(C) creates a pseudocolor plot of the data in the matrix C, where each cell or 'face' in the plot is colored according to the corresponding value in the matrix.

The color of each face is determined by a colormap, which maps data values to colors.

Examples

X = linspace(0, 2*pi, 100);
Y = linspace(0, 2*pi, 100);
Z = sin(X' * Y);
f = figure()
pcolor(X, Y, Z)
f = figure();
rng('default');
ax1 = subplot(1, 2, 1);
C1 = rand(20, 10);
pcolor(ax1, C1)
ax2 = subplot(1, 2, 2);
C2 = rand(50, 10);
pcolor(ax2, C2)

See also

surf, meshgrid.

History

VersionDescription
1.0.0initial version

Author

Allan CORNET