element-blank

Blank element: hides the corresponding theme element.

Pass the result to theme under keys like panel-grid or axis-line to turn them off entirely.

Usage

element-blank()

Returns

Element dictionary consumed by theme.

Examples

Hide the panel grid entirely.

#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(panel-grid: element-blank()),
  width: 10cm,
  height: 6cm,
)

Scatter plot of y against x with the panel grid hidden via element-blank, leaving only axis lines and tick labels.

Scatter plot of y against x with the panel grid hidden via element-blank, leaving only axis lines and tick labels.

Combine element-blank with other overrides to remove multiple non-data marks at once.

#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(
    panel-grid: element-blank(),
    axis-line: element-blank(),
  ),
  width: 10cm,
  height: 6cm,
)

Scatter plot of y against x with both panel grid and axis lines hidden via element-blank, removing the chart frame at once.

Scatter plot of y against x with both panel grid and axis lines hidden via element-blank, removing the chart frame at once.

See also

theme, element-text, element-line, element-rect.

Back to top