The sketch analogue of ggplot2::annotate(). Creates a one-off layer of
fixed, hand-drawn marks that do not inherit the plot's aesthetics — useful
for highlighting, callouts, and reference shapes.
Usage
annotate_sketch(
geom,
x = NULL,
y = NULL,
xmin = NULL,
xmax = NULL,
ymin = NULL,
ymax = NULL,
xend = NULL,
yend = NULL,
r = NULL,
a = NULL,
b = NULL,
seed = NULL,
na.rm = FALSE,
...
)Arguments
- geom
Name of the sketch geom to draw. One of
"point","line","path","segment","rect","polygon","circle","ellipse".- x, y, xmin, xmax, ymin, ymax, xend, yend
Positioning aesthetics (numeric vectors, recycled to a common length). Supply the ones the chosen geom needs (e.g.
xmin/xmax/ymin/ymaxfor"rect",xend/yendfor"segment").- r, a, b
Radius (
"circle") or semi-axes ("ellipse").- seed
Integer seed for reproducible wobble.
- na.rm
If
FALSE(default), missing values trigger a warning.- ...
Other arguments passed to the underlying
geom_sketch_*()layer (e.g.colour,fill,roughness,fill_style).
See also
Other sketch-geoms:
GeomSketchAbline,
GeomSketchBoxplot,
GeomSketchBracket,
GeomSketchCol,
GeomSketchCurve,
GeomSketchEllipse,
GeomSketchHex,
GeomSketchLine,
GeomSketchLinerange,
GeomSketchPath,
GeomSketchPoint,
GeomSketchPolygon,
GeomSketchRect,
GeomSketchRibbon,
GeomSketchRug,
GeomSketchSegment,
GeomSketchSmooth,
GeomSketchSpoke,
GeomSketchViolin,
geom_sketch_bin2d(),
geom_sketch_contour(),
geom_sketch_count(),
geom_sketch_density(),
geom_sketch_density2d(),
geom_sketch_function(),
geom_sketch_histogram(),
geom_sketch_jitter(),
geom_sketch_qq(),
geom_sketch_quantile(),
geom_sketch_text()
Examples
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_sketch_point(seed = 1L) +
annotate_sketch("rect", xmin = 3, xmax = 4, ymin = 15, ymax = 22,
fill = NA, colour = "red", seed = 2L) +
annotate_sketch("segment", x = 2, y = 30, xend = 3.5, yend = 20,
colour = "blue", seed = 3L) +
theme_sketch()
