Skip to contents

Adds a sketchy wobble with automatic scaling and panel masking.

Usage

hand_drawn_wiggle(
  x,
  width = 6,
  height = 4,
  dpi = 300,
  scale = "auto",
  strength = 0.7,
  freq = 0.6,
  seed = 3,
  affect_text = TRUE,
  focus = c("panel", "full", "auto_image"),
  expand_px = c(6L, 6L),
  edge_guard = 0.03,
  fill_bg = NULL
)

Arguments

x

ggplot/grob or magick-image

width, height, dpi

Used when x is ggplot/grob

scale

numeric px or "auto" (default)

strength

0..1 intensity when scale="auto" (default 0.7)

freq

noise frequency (0.2 broad … 1.2 fine)

seed

RNG seed

affect_text

if FALSE, confine warp to panel region

focus

"panel" (default if ggplot), "full", or "auto_image"

expand_px

integer px to expand the panel box (ggplot path)

edge_guard

fade warp near canvas edges (0..0.2)

fill_bg

final background (e.g., "white" or "transparent")

Value

magick-image

Examples

if (FALSE) { # \dontrun{
if (requireNamespace("ggplot2", quietly = TRUE)) {
  p <- ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) + ggplot2::geom_point()
  hand_drawn_wiggle(p)
}
} # }