theme-sub-legend

Shortcut for legend text and title.

Usage

theme-sub-legend(
  text: none,
  title: none,
)

Parameters

Parameter Default Description
text none element-text or element-typst for legend-text.
title none Same for legend-title.

Returns

Theme dictionary with the named legend overrides applied.

Examples

Bold legend titles via the shortcut group.

#let d = range(0, 10).map(i => (x: i, y: i * 0.5, k: if calc.even(i) { "a" } else { "b" }))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "k"),
  layers: (geom-point(size: 2pt),),
  theme: theme-sub-legend(title: element-text(weight: "bold")),
  width: 10cm,
  height: 6cm,
)

Scatter plot of y against x coloured by group k with a bold-weight legend title applied via the legend shortcut group.

Scatter plot of y against x coloured by group k with a bold-weight legend title applied via the legend shortcut group.

See also

theme.

Back to top