draw-key-blank

Draw-key that draws nothing.

Used by geom-blank and as a way to suppress a layer’s legend glyph without removing the legend entirely.

Usage

draw-key-blank()

Returns

Draw-key dictionary consumed by the legend renderer.

Examples

Suppress just the layer’s glyph in the legend, keeping the label slot.

#let d = (
  (x: 1, y: 1, g: "a"),
  (x: 2, y: 2, g: "b"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", fill: "g"),
  layers: (geom-point(size: 3pt, key: draw-key-blank()),),
  width: 8cm,
  height: 5cm,
)

Scatter chart of two fill-coded points where the legend keeps the level labels but renders an empty space instead of swatch glyphs.

Scatter chart of two fill-coded points where the legend keeps the level labels but renders an empty space instead of swatch glyphs.

Useful when one layer in a stack should not appear in the legend; here a geom-line carries the legend, a geom-point is silenced.

#let d = (
  (x: 1, y: 1, g: "a"), (x: 2, y: 2, g: "a"),
  (x: 1, y: 3, g: "b"), (x: 2, y: 1, g: "b"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "g", fill: "g"),
  layers: (
    geom-line(stroke: 1pt),
    geom-point(size: 3pt, key: draw-key-blank()),
  ),
  width: 8cm,
  height: 5cm,
)

Line and point overlay chart for two colour-coded series where only the line layer contributes glyphs to the legend.

Line and point overlay chart for two colour-coded series where only the line layer contributes glyphs to the legend.

See also

draw-key-point, draw-key-line, draw-key-rect, draw-key-path.

Back to top