theme-sub-axis-x

Shortcut for both x axes (top + bottom).

Usage

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

Parameters

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

Returns

Theme dictionary with the named x-axis overrides applied.

Examples

Tint both x-axis edges in red while leaving the y 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-x(
    title: red-text,
    text: red-text,
    line: red-line,
    ticks: red-line,
  ),
  width: 10cm,
  height: 6cm,
)

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

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

See also

theme-sub-axis, theme-sub-axis-y, theme-sub-axis-bottom, theme-sub-axis-top.

Back to top