Skip to contents

The easiest way to add a boxed note: a single hand-drawn callout (with an optional leader arrow) that does not inherit the plot's aesthetics. A thin wrapper around geom_sketch_callout() in the spirit of ggplot2::annotate().

Usage

annotate_sketch_callout(
  x,
  y,
  label,
  xend = NULL,
  yend = NULL,
  seed = NULL,
  ...
)

Arguments

x, y

Box position. Numeric, recycled.

label

Label text.

xend, yend

Optional target the leader points at. NULL (default) draws a boxed label with no leader.

seed

Passed to geom_sketch_callout().

...

Other arguments passed on to geom_sketch_callout() (e.g. colour, fill, roughness, corner_radius, family).

Value

A ggplot2 layer object.

Examples

library(ggplot2)
ggplot(faithful, aes(eruptions, waiting)) +
  geom_sketch_point(seed = 1L) +
  annotate_sketch_callout(x = 2.2, y = 95, label = "short waits",
                          xend = 1.9, yend = 75, seed = 3L) +
  theme_sketch()