AbstractStaticluminanceParses a CSS colour into a 0-1 luminance, or null when the mark is not painted at all.
Only the rgb() and rgba() forms browsers hand back from a computed
style, plus hex, which is what an SVG attribute usually holds. A fully
transparent fill is not a shade — an outlined-only mark has no value to
read — and neither is none.
A CSS colour string
Luminance from 0 (black) to 1 (white), or null
StaticdensitiesTurns a trace's fill colours into how much of each mark's interior to raise, or null when the colours carry no value.
Whether the colours mean anything is decided before this is called, by the trace type — counting distinct shades here looked principled and is not, in both directions: a qualitative palette is chosen to be maximally distinguishable and so offers more shades than a two-value heatmap.
Normalised across the marks actually present rather than against absolute black and white: a heatmap using the pale half of a colour ramp would otherwise come out uniformly blank, and it is the ordering between cells that a reader needs, not the absolute shade.
One entry per mark, in mark order; null where unpainted
Densities from 0 to 1 in the same order, or null when the marks are effectively one colour
Reads the shade a chart painted a mark, so a display with two states per pin can still carry a value the chart encoded as a colour.
A heatmap, a choropleth, a hexbin and a mosaic put their entire content in fill colour: every cell is the same size and shape, so the geometry that reaches the pins is a lattice and nothing else. Measured across the example gallery, a heatmap spent 819 pins drawing an 8x8 grid and delivered none of its 64 values. That is not a degraded picture — it is a confident, crisp diagram containing no data.
Colour cannot be felt, but density can: the darker a mark, the more of its interior is raised. It is coarse — a fingertip separates perhaps four levels — and four levels of a value is the difference between reading a heatmap and reading graph paper.