theme-sub-axis-y

Shortcut for both y axes (left + right).

Usage

theme-sub-axis-y(
  title: none,
  text: none,
  line: none,
  ticks: none,
)

Parameters

Parameter Default Description
title none element-text or element-typst for axis-title-y.
text none Same for axis-text-y.
line none element-line for axis-line-y.
ticks none element-line for axis-ticks-y.

Returns

Theme dictionary with the named y-axis overrides applied.

Examples

Tint both y-axis edges in red while leaving the x axis alone.

#let red-text = element-text(colour: rgb("#cc0000"))
#let red-line = element-line(colour: rgb("#cc0000"))
#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),),
  theme: theme-sub-axis-y(
    title: red-text,
    text: red-text,
    line: red-line,
    ticks: red-line,
  ),
  width: 10cm,
  height: 6cm,
)

Scatter plot of y against x with both y-axis titles, tick labels, axis line and ticks tinted red via the y-axis shortcut while the x axis stays default.

Scatter plot of y against x with both y-axis titles, tick labels, axis line and ticks tinted red via the y-axis shortcut while the x axis stays default.

See also

theme-sub-axis, theme-sub-axis-x, theme-sub-axis-left, theme-sub-axis-right.

Back to top