draw-key-line

Draw-key returning a short horizontal line.

Used by line, path, step, smooth, segment, hline, vline, and abline geoms.

Usage

draw-key-line()

Returns

Draw-key dictionary consumed by the legend renderer.

Examples

Short stroke glyph (the default for line layers).

#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"),
  layers: (geom-line(key: draw-key-line()),),
  width: 8cm,
  height: 5cm,
)

Line chart with two colour-coded series and a legend that uses short horizontal stroke segments as the level glyphs.

Line chart with two colour-coded series and a legend that uses short horizontal stroke segments as the level glyphs.

Override a column layer’s default rectangle glyph with a line stroke.

#let d = (
  (g: "a", n: 3),
  (g: "b", n: 5),
)
#plot(
  data: d,
  mapping: aes(x: "g", y: "n", fill: "g"),
  layers: (geom-col(key: draw-key-line()),),
  width: 8cm,
  height: 5cm,
)

Bar chart of two fill-coded columns with the legend swatch replaced by short horizontal stroke segments instead of filled rectangles.

Bar chart of two fill-coded columns with the legend swatch replaced by short horizontal stroke segments instead of filled rectangles.

See also

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

Back to top