Skip to contents

Two one-off emphasis annotations (constant positions, inherit.aes = FALSE):

Usage

annotate_sketch_highlight(
  x,
  y,
  xend,
  yend,
  colour = "#f7e017",
  linewidth = 8,
  seed = NULL,
  ...
)

annotate_sketch_underline(
  x,
  y,
  xend,
  colour = "grey15",
  linewidth = 0.7,
  strokes = 1L,
  roughness = 1.6,
  bowing = 0.4,
  seed = NULL,
  ...
)

Arguments

x, y, xend, yend

Endpoint positions in data units (vectors recycle). annotate_sketch_underline() is horizontal: yend defaults to y.

colour

Ink colour. Highlight defaults to fluorescent yellow.

linewidth

Stroke width. The highlighter medium multiplies it into a wide band; the underline stays a line.

seed

Integer seed for reproducible wobble.

...

Other arguments passed to geom_sketch_segment().

strokes

Number of overlapped underline strokes. Default 1.

roughness

Wobble amount. Underlines default a little shakier.

bowing

Bow of the underline stroke (kept low so repeated strokes stay together). Default 0.4.

Value

A ggplot2 layer object.

Details

  • annotate_sketch_highlight() lays a wide, translucent chisel-tip band (the "highlighter" medium) from (x, y) to (xend, yend) – swipe it over a line, a label or a region of interest like a fluorescent marker.

  • annotate_sketch_underline() draws a quick wobbly stroke from (x, y) to (xend, y) – an underline for a data point or a piece of text. strokes > 1 re-draws it with fresh wobble for an emphatic scrawl.

Examples

library(ggplot2)
ggplot(economics[1:60, ], aes(date, unemploy)) +
  geom_sketch_line(seed = 1L) +
  annotate_sketch_highlight(
    x = as.Date("1969-01-01"), y = 2800,
    xend = as.Date("1970-06-01"), yend = 2800
  ) +
  theme_sketch()