Skip to contents

The easiest way to point at something: a single hand-drawn arrow (with an optional handwriting label) that does not inherit the plot's aesthetics. A thin wrapper around geom_sketch_arrow() in the spirit of ggplot2::annotate().

Usage

annotate_sketch_arrow(
  x,
  y,
  xend,
  yend,
  label = NULL,
  curvature = "auto",
  roughness = 1,
  arrow_type = "open",
  seed = NULL,
  ...
)

Arguments

x, y

Source point (where the label sits). Numeric, recycled.

xend, yend

Target point (where the arrow points). Numeric, recycled.

label

Optional text shown at the source. NULL draws a bare arrow.

curvature, roughness, arrow_type, seed

Passed to geom_sketch_arrow().

...

Other arguments passed on to geom_sketch_arrow() (e.g. colour, linewidth, arrow_length, family).

Value

A ggplot2 layer object.

Examples

library(ggplot2)
ggplot(faithful, aes(eruptions, waiting)) +
  geom_sketch_point(seed = 1L) +
  annotate_sketch_arrow(x = 2.2, y = 90, xend = 1.9, yend = 75,
                        label = "short bursts", colour = "#C0392B",
                        seed = 3L) +
  theme_sketch()