heatmap — Create heatmap charts in MATLAB and RunMat.

heatmap creates heatmap charts from numeric matrix data. Supported call forms, returned handle behavior, and chart properties follow MATLAB semantics.

Syntax

h = heatmap(CData)
h = heatmap(XValues, YValues, CData)
h = heatmap(XValues, YValues, CData, Name, Value, ...)

Inputs

NameTypeRequiredDefaultDescription
CDataNumericArrayYesM-by-N numeric matrix of color values.
XValuesAnyYesColumn labels (length N).
YValuesAnyYesRow labels (length M).
propsAnyVariadicHeatmap property name/value pairs.

Returns

NameTypeDescription
hNumericScalarHandle to the heatmap chart.

Errors

IdentifierWhenMessage
RunMat:heatmap:InvalidArgumentCData/label/property inputs are malformed or incompatible.heatmap: invalid argument
RunMat:heatmap:InternalInternal render/surface construction fails.heatmap: internal operation failed

How heatmap works

  • heatmap(CData) displays matrix values using default row and column labels.
  • heatmap(XValues, YValues, CData) uses text, string-array, cell-array, or numeric labels for the displayed columns and rows.
  • The returned heatmap handle participates in RunMat's plotting property system.
  • Color rendering uses the shared scaled-image and colormap path.

Examples

Create a labeled heatmap chart

cdata = [45 60 32; 43 54 76; 32 94 68; 23 95 58];
xvalues = {'Small','Medium','Large'};
yvalues = {'Green','Red','Blue','Gray'};
h = heatmap(xvalues,yvalues,cdata);
h.Title = 'T-Shirt Orders';
h.XLabel = 'Sizes';
h.YLabel = 'Colors';

Create a heatmap from matrix data

A = magic(5);
h = heatmap(A);
h.Colormap = 'hot';
h.ColorbarVisible = true;

Rendered heatmap example

results = [92 88 81 76; 85 91 87 82; 78 84 93 89; 90 86 80 94];
conditions = {'Cold', 'Nominal', 'Hot', 'Vibration'};
components = {'Pump A', 'Pump B', 'Valve A', 'Valve B'};

h = heatmap(conditions, components, results);
h.Title = 'Component Test Score';
h.XLabel = 'Test condition';
h.YLabel = 'Component';
h.Colormap = 'turbo';
h.ColorbarVisible = true;
Expected output:
Component test-score matrix rendered as a MATLAB heatmap in RunMat

Compare this result with other chart types in the MATLAB Plot Gallery.

Using heatmap with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how heatmap changes the result.

Run a small heatmap example, explain the result, then change one input and compare the output.

FAQ

Does heatmap support table inputs?

Not yet. RunMat currently supports matrix CData inputs with optional row and column labels. Table-based MATLAB signatures will be added once table values are represented in the runtime.

More plotting resources

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how heatmap is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.