imagesc

Display a matrix as an image with scaled colors.

Syntax

h = imagesc(z)

h = imagesc(x, y, z)

h = imagesc(..., [cmin cmax])

Inputs

x, y, z
Range of the x, y, and z axes.
Type: double | integer
cmin, cmax
Range of the colormap.
Type: double | integer

Outputs

h
Handle of the imagesc graphics object.

Examples

Simple imagesc example:

cla;
z = [1 2 3; 4 5 6; 7 8 9];
imagesc(z)
colorbar
Figure 1.

imagesc with colormap limits example:

cla;
z = [1 2 3; 4 5 6; 7 8 9];
imagesc(z, [3 7]);
colorbar
Figure 2.

Comments

If there are no axes, they will be created first. If x and y are omitted, the index of the z columns is used for the x coordinates and the index of the z rows is used for the y coordinates.