geom-tile
Tile layer: filled rectangle centred at (x, y) per row.
width and height default to 1 in data units; both may be mapped via aes or fixed via the layer parameters.
Usage
geom-tile(
mapping: none,
data: none,
width: 1,
height: 1,
colour: auto,
fill: auto,
stroke: none,
alpha: auto,
stat: "identity",
position: "identity",
inherit-aes: true,
)Parameters
| Parameter | Default | Description |
|---|---|---|
mapping |
none |
Layer-specific aesthetic mapping built with aes. Must map x, y. |
data |
none |
Layer-specific dataset. Falls back to the plot data when none. |
width |
1 |
Default tile width in data units when not mapped. |
height |
1 |
Default tile height in data units when not mapped. |
colour |
auto |
Fixed outline colour. auto resolves via the colour scale, falling back to the theme ink only when neither colour nor fill is set. |
fill |
auto |
Fixed fill colour. auto resolves via the fill scale or a neutral default. |
stroke |
none |
Outline thickness (a Typst length) or stroke dictionary; none disables the outline. |
alpha |
auto |
Fill opacity in [0, 1]. |
stat |
"identity" |
Statistical transform name. Usually "identity". |
position |
"identity" |
Position adjustment name. Usually "identity". |
inherit-aes |
true |
Whether to merge the plot-level mapping into this layer’s mapping. |
Returns
Layer dictionary consumed by plot.
Examples
Heatmap of v values across an integer grid.
#let d = ()
#for x in range(0, 5) {
for y in range(0, 4) {
d.push((x: x, y: y, v: x + y))
}
}
#plot(
data: d,
mapping: aes(x: "x", y: "y", fill: "v"),
layers: (geom-tile(),),
width: 10cm,
height: 6cm,
)Pair the heatmap with a viridis scale for a perceptually uniform palette.
#let d = ()
#for x in range(0, 5) {
for y in range(0, 4) {
d.push((x: x, y: y, v: x * y))
}
}
#plot(
data: d,
mapping: aes(x: "x", y: "y", fill: "v"),
layers: (geom-tile(),),
scales: (scale-fill-viridis-c(option: "magma"),),
width: 10cm,
height: 6cm,
)