geom-vline
Vertical reference line at one or more x intercepts.
xintercept can be a scalar or an array. The layer does not inherit the plot mapping by default; it draws purely from the xintercept parameter.
Usage
geom-vline(
xintercept: none,
colour: auto,
stroke: 0.6pt,
alpha: auto,
linetype: "solid",
inherit-aes: false,
)Parameters
| Parameter | Default | Description |
|---|---|---|
xintercept |
none |
Scalar or array of x values at which to draw vertical lines. |
colour |
auto |
Line colour. auto inherits the theme ink. |
stroke |
0.6pt |
Line thickness (a Typst length). |
alpha |
auto |
Line opacity in [0, 1]. |
linetype |
"solid" |
Dash keyword. Defaults to "solid". |
inherit-aes |
false |
Whether to merge the plot-level mapping into this layer’s mapping. Defaults to false. |
Returns
Layer dictionary consumed by plot.
Examples
Two vertical reference lines at x = 3 and x = 6.
#let d = range(0, 10).map(i => (x: i, y: i * 0.5))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (
geom-point(size: 2pt),
geom-vline(xintercept: (3, 6), colour: rgb("#4c78a8")),
),
width: 10cm,
height: 6cm,
)A single dashed reference line at the data midpoint.
#let d = range(0, 10).map(i => (x: i, y: i * 0.5))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (
geom-point(size: 2pt),
geom-vline(xintercept: 4.5, stroke: 1pt, colour: rgb("#cc0000")),
),
width: 10cm,
height: 6cm,
)