pcolor(C)
pcolor(x,y,C)
pcolor(X,Y,C)
h = pcolor(...)
pcolor(C)
draws a pseudocolor plot, a rectangular array of cells with colors determined by the elements of C
. A pseudocolor plot is actually a surface plot seen from the top. MATLAB creates this type of plot by using each set of four adjacent points in C
to define a patch object.
With the default shading mode, faceted
, each cell has a constant color determined by the corner with the smallest xy coordinates, and the last row and column of C
are not used. With interp
shading, each cell has color resulting from bilinear interpolation of the color at its four vertices and all elements of C
are used. The mapping from C
to color
is defined by colormap
and caxis
.
pcolor(x,y,C)
with two vector arguments must have length(x) = n
and length(y) = m
where [m,n] = size(C)
. The spacing of the grid lines is set by x
and y
, so the grid lines are straight, but not necessarily evenly spaced. Note that x
corresponds to the columns of C
and y
corresponds to the rows.
pcolor(X,Y,C)
has three matrix arguments, all the same size. A logically rectangular, two-dimensional grid is drawn with vertices at the points [X(i,j), Y(i,j)]
. The color in the (i,j)
th cell is determined by C(i,j)
if shading is faceted
or flat
, or by interpolation between the colors at the four vertices if shading is interp
.
pcolor
is closely related to surf
; in fact, pcolor(X,Y,C)
is the same as viewing surf(X,Y,0
*Z,C)
from above, that is, view([0 90])
.
pcolor
and image
are similar, but pcolor(C)
specifies the colors of vertices whereas image(C)
specifies the colors of cells and directly indexes into the colormap with no scaling. Consequently, the number of vertices for pcolor(C)
is the same as the number of cells for image(C)
. With three arguments, pcolor(X,Y,C)
can produce parametric grids, which are not possible with image
.
h = pcolor(...)
returns a handle to a surface
object. surface
objects are children of axes
.
pcolor(hadamard(20))
colormap(gray(2))
axis('ij')
axis('square')
A simple color wheel illustrates a polar coordinate system.
n = 6;
r = (0:n)'/n;
theta = pi
*(-n:n)/n;
X = r
*cos(theta);
Y = r
*sin(theta);
C = r
*cos(2
*theta);
pcolor(X,Y,C)
axis('square')
image
,surf
,view
(c) Copyright 1994 by The MathWorks, Inc.