Manual
Overview
Language
IntroductionScenes & structureText & inlineGraphsCode panesAnimationDataReuse & logicExpressions & parameters
Elements
Text
ParagraphHeading 1Heading 2Heading 3Heading 4Unordered ListDivider
Media
ImageTableEquation
Callouts
NoteDefinitionExampleTask
Graph
GraphLinePolygonCurveIntegralScatterHistogramPointSegmentVectorCircleSquareRectangleTriangleStarDiamondHexagonTextAxis labelAxis BraceFitResidualsContourHeatmapParameter
Code
Code canvasLines
Animation
CueDraw cueTrace cueHighlight cueSpotlight cueType cue
Structure
SceneStep
Reference
Internote Reference
Inline
Formatting
BoldItalicsInline CodeHighlightLink
Text colour
Red textOrange textYellow textGreen textTeal textBlue textPurple textPink textGrey text
Maths
Maths
Reference
Internote ReferenceValueConstant
Other
FootnoteIcon
Directives
DatasetIncludeConstantsTemplatePresetConditionalForIgnore
Keyframes
KeyframeZoom keyframe
Attribute types
?
  1. Elements
  2. Graph
  3. Heatmap

Heatmap

heatmapBlock elementGraph

The same surface a contour traces, shaded instead: one expression in x AND y, grid-sampled over the visible window and drawn as a continuous wash of the mark's hue — bare where the value is low, full where it is high. The two marks compose: a heatmap under a contour is the classic landscape rendering, and @let keeps the shared expression written once. As with contour, `y` is the vertical axis, not a parameter.

Attributes

expressionRequiredImplicit
parametised-surface-expression
Also written: exp, f, func, functionMath expression for the surface's value at (x, y). Free letters beyond x and y are parameters.The head shorthand supplies it: heatmap:value
range
parametised-interval
The value window the ramp spans, e.g. `[0, 40]`; values outside clamp. Absent, the ramp spans the sampled extrema — which re-normalises as a parameter drags; an authored range holds still, exactly as an authored domain does.
invert
boolean
Flip the ramp: deep colour at LOW values. On a loss surface it is the basin that should glow.
Defaultfalse
colour
surface-colour
Also written: colormulticolour (the default) runs the full spectrum, violet low to red high; temperature is the blue → white → red wash — pair it with a symmetric `range:` to pin white at zero; any ordinary hue shades its own intensity ramp instead. Both ramps are fixed colours, identical in light and dark mode.
Defaultmulticolour
opacity
number
How heavy the wash sits over the plot.
Default0.75
hidden
boolean
Declared but not drawn — animatable, so `hidden: true !cue.to{false}(at: 2)` is its reveal.
Defaultfalse
lock
boolean
Also written: lockedA reader may not edit it on an editable graph.
Defaultfalse
z
parametised-number
Draw order within the pane.

Derived attributes

Computed while the element renders — read one with #id.name in attribute position or !value:#id.name() in prose, never set.

minDerived
The smallest value the surface takes over the sampled window. Cite it with !value:#id.min().
maxDerived
The largest value the surface takes over the sampled window.

Allowed in

canvas.graph { }

Examples

heatmap(expression: x*y; range: [-9, 9]; colour: temperature)
heatmap(expression: x^2 + y^2)
heatmap(expression: (x - 2)^2 + (y - 3)^2; colour: red; invert: true)
heatmap(expression: {{sse}}; opacity: 0.5)
contour(expression: {{sse}}; at: 1, 2, 4, 8, 16)
On this page
AttributesDerived attributesAllowed inExamples
Heatmap · Internote