stat-contour-filled
Filled iso-band statistic. Partitions the (x, y, z) field into bands defined by successive levels and emits one closed polygon per cell that touches each band. Pair with geom-polygon or geom-contour-filled.
bins, binwidth, and breaks follow stat-contour precedence, but with one extra level so neighbouring lines bound n + 1 bands (i.e., bins: 10 produces ~11 levels and 10 bands).
Usage
stat-contour-filled(
bins: 10,
binwidth: none,
breaks: auto,
)Parameters
| Parameter | Default | Description |
|---|---|---|
bins |
10 |
Target band count when breaks and binwidth are unset. |
binwidth |
none |
Fixed step between successive levels. Overrides bins. |
breaks |
auto |
Explicit array of level boundaries. Overrides the rest. |
Returns
Statistic object with name: "contour_filled".
Outputs
x.y.group._level.
Examples
Drive geom-polygon with the constructor form to fill eight iso-bands of sin(x) * cos(y) and paint them via the viridis palette.
#let n = 30
#let d = ()
#for i in range(n) { for j in range(n) {
let x = -3 + 6 * i / (n - 1)
let y = -3 + 6 * j / (n - 1)
d.push((x: x, y: y, z: calc.sin(x) * calc.cos(y)))
} }
#plot(
data: d,
mapping: aes(x: "x", y: "y", z: "z"),
layers: (geom-polygon(stat: stat-contour-filled(bins: 8)),),
scales: (scale-fill-viridis-c(),),
width: 10cm,
height: 6cm,
)