Expand description
Bivariate fill scale: two binned variables → an n × m palette
(biscale-style; Stevens 1994’s bivariate-choropleth method), backing a
::BIVARIATE choropleth. Ported from the design in
anofox-visualization’s docs/plans/plan-maps.md (§15, D10) — DataZooDE/
anofox-visualization#318, #182.
The binning itself (computing each variable’s tertile/class index) is
the caller’s job, same as super::binned::ScaleFillBinned’s break
maths — this scale only colours an already-binned composite class.
Follow the biscale R package’s own convention: a composite class is a
1-indexed "{x_class}-{y_class}" string (e.g. "3-2" = x-tertile 3,
y-tertile 2), the value a bi_class()-style data-prep step would put in
a fill column.
Structs§
- Scale
Fill Bivariate - Bivariate fill scale:
nx × nyclasses, each class"{i}-{j}"(1-indexed) coloured bybivariate_cell_color. See the module docs.
Functions§
- bivariate_
cell_ color - The colour for class
(i, j)(0-indexed) of annx × nygrid: each channel ofbaseis pulled toward the matching channel ofcolor_xbytx = i/(nx-1)and towardcolor_ybyty = j/(ny-1), subtracted (not averaged) so the two axes compound rather than cancel —base − tx·(base − color_x) − ty·(base − color_y), clamped to0..=255. At(0, 0)this is exactlybase; at(nx-1, 0)exactlycolor_x; at(0, ny-1)exactlycolor_y; at the high-high corner the two subtractions compound (usually clamping low), the classic bivariate-choropleth “dark/saturated corner” look.baseis the low-low cell’s colour — white for a light theme; pass a theme’s card colour for a “lifted over the card colour” dark variant (plan-maps.md §15’s D10) instead of guessing a theme from inside this crate.