FUNCTION REFERENCE

heatmap

Heatmap of a matrix.

Heatmap of a matrix.

Syntax

h = heatmap(cdata)

Syntax

h = heatmap(xvalues, yvalues, cdata)

Syntax

h = heatmap(..., Name, Value)

Draws one coloured cell per element of cdata, row 1 at the top, with the value written in each cell and a colour scale on the right. xvalues and yvalues (cell arrays of texts or numbers) label the columns and rows. Options: ColorLimits, CellLabelColor ('none' hides the cell values), ColorbarVisible, Title, XLabel and YLabel. NaN cells are grey. get answers ColorData, ColorLimits and CellLabelColor.

Example

h = heatmap([1 2; 3 4]); get(h, 'ColorData')   % [1 2; 3 4]

Example

heatmap({'a', 'b'}, {'x', 'y'}, magic(2), 'Title', 'Counts');

Differences from MATLAB: the colour scale is a 16-step sequential ramp from the first plot-palette colour, not a colormap. Labels are figure textboxes (at most 64 per figure): cell values are left out when they do not fit, and category labels too for large matrices. At most 100 by 100 cells. The cells are drawn on Cartesian axes with the tick labels hidden.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.