Note: This page has been translated by MathWorks. Please click here

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

Pseudocolor (checkerboard) plot

`pcolor(C)`

pcolor(X,Y,C)

pcolor(axes_handles,...)

h = pcolor(...)

A pseudocolor plot is a rectangular array of cells with colors
determined by `C`

. MATLAB^{®} creates a pseudocolor
plot using each set of four adjacent points in `C`

to
define a surface rectangle (i.e., cell).

The default `shading`

is `faceted`

,
which colors each cell with a single color. The last row and column
of `C`

are not used in this case. With `shading`

`interp`

,
each cell is colored by bilinear interpolation of the colors at its
four vertices, using all elements of `C`

.

The minimum and maximum elements of `C`

are
assigned the first and last colors in the colormap. Colors for the
remaining elements in `C`

are determined by a linear
mapping from value to colormap element.

`pcolor(C)`

draws a pseudocolor
plot. The elements of `C`

are linearly mapped to
an index into the current colormap. The mapping from `C`

to
the current colormap is defined by `colormap`

and `caxis`

.

`pcolor(X,Y,C)`

draws a
pseudocolor plot of the elements of `C`

at the locations
specified by `X`

and `Y`

. The plot
is a logically rectangular, two-dimensional grid with vertices at
the points `[X(i,j), Y(i,j)]`

. `X`

and `Y`

are
vectors or matrices that specify the spacing of the grid lines. If `X`

and `Y`

are
vectors, `X`

corresponds to the columns of `C`

and `Y`

corresponds
to the rows. If `X`

and `Y`

are
matrices, they must be the same size as `C`

.

`pcolor(axes_handles,...)`

plots into the axes with handle `axes_handle`

instead
of the current axes (`gca`

).

`h = pcolor(...)`

returns
a handle to a `surface`

graphics
object.

A pseudocolor plot is a flat surface plot viewed from above. `pcolor(X,Y,C)`

is
the same as viewing `surf(X,Y,zeros(size(X)),C)`

using ```
view([0
90])
```

.

When you use `shading`

`faceted`

or `shading`

`flat`

,
the constant color of each cell is the color associated with the corner
having the smallest *x*-*y* coordinates.
Therefore, `C(i,j)`

determines the color of the cell
in the *i*th row and *j*th column.
The last row and column of `C`

are not used.

When you use `shading interp`

, each cell's
color results from a bilinear interpolation of the colors at its four
vertices, and all elements of `C`

are used.

Use the `pcolor`

, `image`

,
or `imagesc`

function to display image data. Each
function displays a rectangular array of cells and uses `C`

to
determine the colors.

`pcolor(C)`

uses the values in`C`

to define the vertex colors by scaling the values to map to the full range of the colormap. The size of`C`

determines the number of vertices.`pcolor`

determines the cell colors using the colors defined at the cell vertices.`image(C)`

uses`C`

to define the cell colors by mapping the values directly into the colormap. The size of`C`

determines the number of cells.`imagesc(C)`

uses`C`

to define the cell colors by scaling the values to map to the full range of the colormap. The size of`C`

determines the number of cells.

`pcolor(X,Y,C)`

can produce parametric grids,
which is not possible with `image`

or `imagesc`

.

Was this topic helpful?