geom-pointrange
Pointrange layer: a marker at (x, y) plus a linerange from ymin to ymax.
Mapping must provide x, y, ymin, ymax. colour paints the range line and the point outline; fill paints the point body.
Usage
geom-pointrange(
mapping: none,
data: none,
size: 2.5pt,
stroke: 0.8pt,
colour: auto,
fill: auto,
alpha: auto,
linetype: "solid",
stat: "identity",
position: "identity",
inherit-aes: true,
)Parameters
| Parameter | Default | Description |
|---|---|---|
mapping |
none |
Layer-specific aesthetic mapping built with aes. Must map x, y, ymin, ymax. |
data |
none |
Layer-specific dataset. Falls back to the plot data when none. |
size |
2.5pt |
Point radius (a Typst length). |
stroke |
0.8pt |
Line thickness (a Typst length). |
colour |
auto |
Fixed range-line colour. auto resolves via the colour scale. |
fill |
auto |
Fixed point body fill. auto resolves via the fill scale, falling back to the resolved range-line colour. |
alpha |
auto |
Opacity in [0, 1]. |
linetype |
"solid" |
Dash keyword for the range line. Defaults to "solid". |
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
Centred point with vertical range, drawn together for forest-plot style summaries.
#let d = range(1, 6).map(i => (
x: i,
y: i,
lo: i - 0.5,
hi: i + 0.5,
))
#plot(
data: d,
mapping: aes(x: "x", y: "y", ymin: "lo", ymax: "hi"),
layers: (geom-pointrange(size: 3pt),),
width: 10cm,
height: 6cm,
)Map colour to a categorical column to colour both the point and its range per group.
#let d = range(1, 6).map(i => (
x: i, y: i, lo: i - 0.5, hi: i + 0.5,
k: if calc.rem(i, 2) == 0 { "even" } else { "odd" },
))
#plot(
data: d,
mapping: aes(x: "x", y: "y", ymin: "lo", ymax: "hi", colour: "k"),
layers: (geom-pointrange(size: 3pt),),
width: 10cm,
height: 6cm,
)