Back to Data Visualization

imagesc

Display matrix as scaled image

Syntax

imagesc(C)
imagesc(x, y, C)
imagesc(..., clims)

Description

Displays a matrix C as an image with scaled colors. Each element of C maps to a color in the colormap, with the minimum value mapping to the first color and maximum to the last. Optional x and y vectors specify the coordinates of the columns and rows.

Parameters

NameDescription
x(optional)X-axis coordinates for columns (2-element vector or full vector)
y(optional)Y-axis coordinates for rows (2-element vector or full vector)
CData matrix to display
clims(optional)Color limits [cmin cmax]

Returns

null (renders heatmap inline)

Examples

Try It
>> A = magic(5);
imagesc(A)
Try It
>> A = peaks(50);
imagesc(A)
colorbar
Try It
>> imagesc([0 10], [0 5], rand(10, 20))
title('Random data')

See Also