guide-custom
Render arbitrary Typst content as a legend slot.
Unlike scale-driven guides, guide-custom carries its own content and has no aesthetic to consume; it sits next to the auto-built legends in the order it appears in the guides binding.
Usage
guide-custom(
content,
width: auto,
height: auto,
title: none,
position: "right",
direction: auto,
order: none,
byrow: false,
)Parameters
| Parameter | Default | Description |
|---|---|---|
content |
Typst content block (markup, image, table, …). | |
width |
auto |
Block width as a length, or auto for the default 3cm. |
height |
auto |
Block height as a length, or auto for the default 2cm. |
title |
none |
Optional title rendered above the block using the legend-title surface. |
position |
"right" |
Where the custom block sits. Same accepted values as guide-legend.position ("top", "right", "bottom", "left", "none", a Typst alignment, or a (dx:, dy:) / (x:, y:) dict). |
direction |
auto |
"horizontal" or "vertical"; auto infers from position. Affects title placement only since custom content is opaque. |
order |
none |
Integer priority among multiple guides; lower draws first. none defers to the default aesthetic order. |
byrow |
false |
Accepted for API uniformity with guide-legend; ignored because custom content is opaque. |
Returns
Marker dictionary tagged kind: "guide-custom", consumed by guides.
Examples
Add a free-form annotation block alongside the colour legend.
#let d = (
(x: 1, y: 1, g: "a"),
(x: 2, y: 2, g: "b"),
(x: 3, y: 3, g: "c"),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", colour: "g"),
layers: (geom-point(size: 3pt),),
guides: guides(
custom: guide-custom(
[Series sourced from internal sales reports.],
width: 4cm,
height: 1.4cm,
title: "Notes",
),
),
width: 10cm,
height: 6cm,
)