Two habits of a real hand that the default sketch strokes leave out, for
options(ggsketch.tremor = ):
Arguments
- drift
How far long strokes wander, non-negative. At 1, a stroke drawn with
roughness = 1wanders up to about a sixteenth of an inch. Default 0 (off).- fatigue
How shaky strokes grow, non-negative. At 1, a stroke drawn with
roughness = 1shakes by up to about a thirtieth of an inch by its fourth inch. Default 0 (off).
Value
A ggsketch_tremor object to set as options(ggsketch.tremor = ).
options(ggsketch.tremor = NULL) (the default) turns the tremor off.
Details
Drift. Over a long stroke the hand wanders: the line bends gently off its course and back, about an inch at a time. Both ends of a stroke stay where they were, so arrows still reach their targets and outlines still close, and short strokes barely move.
Fatigue. The hand tires as it goes: each stroke starts steady and picks up a fine tremor that grows over its first four inches, so a long stroke ends shakier than it began.
The tremor reaches every roughened stroke: lines and paths, the outlines of
bars, polygons, circles and other shapes, arrows, leaders, note and callout
boxes, and the hand-drawn frame of element_sketch_line() and
coord_sketch(). Fills, points and text are left as they are. Its size
scales with each stroke's roughness, so roughness = 0 stays clean, and
it is seeded from each stroke's own seed.
A plot takes the tremor in force when it is printed or saved and keeps it: resizing its window, or knitr saving a figure after its chunk has run, redraws it with the same tremor even if the option has been reset since.
See also
Other sketch-media:
scale_medium_discrete(),
sketch_media()
Examples
library(ggplot2)
p <- ggplot(economics, aes(date, unemploy)) +
geom_sketch_line(seed = 1L) +
theme_sketch()
old <- options(ggsketch.tremor = sketch_tremor(drift = 1, fatigue = 1))
p
options(old)
