arrow
Arrowhead spec for the line geoms and the text-geom connectors.
Pass the result to the arrow parameter of a line geom, where it marks the direction the line runs, or of a text geom, where it marks the connector running to its data point. The head takes the colour and thickness of the line it sits on, and stays solid under a dashed linetype.
Usage
arrow(
length: 4pt,
angle: 25deg,
ends: "last",
type: "open",
)Parameters
| Parameter | Default | Description |
|---|---|---|
length |
4pt |
Head length along each wing (a Typst length). |
angle |
25deg |
Half-opening of the head, in (0deg, 90deg). Smaller values give a narrower head. |
ends |
"last" |
Which end of the line carries a head: "last", "first", or "both". On a multi-point geom the ends are the ends of the whole group, not of every join. |
type |
"open" |
"open" strokes a V; "closed" fills a triangle. |
Returns
Arrow specification dictionary.
Examples
Three segments carrying an open head at their far end.
#let d = (
(x: 0, y: 0, xend: 4, yend: 3),
(x: 0, y: 3, xend: 4, yend: 0),
(x: 2, y: 0, xend: 2, yend: 3),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", xend: "xend", yend: "yend"),
layers: (geom-segment(stroke: 1pt, arrow: arrow(length: 8pt)),),
width: 10cm,
height: 6cm,
)A closed head at both ends, marking a span rather than a direction.
#let d = ((x: 1, y: 1, xend: 5, yend: 1),)
#plot(
data: d,
mapping: aes(x: "x", y: "y", xend: "xend", yend: "yend"),
layers: (
geom-segment(
stroke: 1pt,
arrow: arrow(length: 10pt, ends: "both", type: "closed"),
),
),
width: 10cm,
height: 4cm,
)See also
geom-segment, geom-curve, geom-spoke, geom-path, geom-line, geom-step, geom-text, geom-label, geom-typst.