imagesc
Displays a matrix as an image with values scaled to the full colormap.
Category: Graphics > Images
Syntax
imagesc(C)
Displays C, mapping its minimum and maximum to the ends of the colormap.
imagesc(x, y, C)
Also sets the pixel coordinates.
imagesc(___, clims)
Uses [cmin cmax] as the color limits instead of the data range.
h = imagesc(___)
Returns the image object.
Description
Think of imagesc as image with scaling: it sets the color limits (clim) from the data, so any range of values uses the whole colormap. It is the usual way to visualize a matrix as a heat map; add colorbar to show what the colors mean.
Input arguments
C- Matrix of values, any real numeric class.
clims- Two-element vector with the values mapped to the first and last colors.
Output arguments
h- Image object.
Example
Heat map of a matrix
A = magic(5);
h = imagesc(A);
colorbar
disp(size(h.CData))
Output
5 5