mypaintr

1 min read Original article ↗

mypaintr is an R package that lets you plot graphics in a human-like, sketched way, using brushes from the libmypaint library and algorithms for “rough” lines and polygons.

Installation:

# install.packages("pak")
pak::pak("hughjonesd/mypaintr")

A base R barplot using a custom brush, plus a hand-drawn axis:

A ggplot using a custom element:

Sketchy lines using the ordinary base R device:


plot(1:10, 1:10, type = "n", xlab = "", ylab = "", axes = FALSE)

draw_rough_polygons(5 + 3 * sin(2*pi * 1:5/5), 5 + 3 * cos(2*pi * 1:5/5),
                    border = "darkred", col = "red3", lwd = 2,
                    hand = human_hand(seed = 1, multi_stroke = 3),
                    fill_pattern = crosshatch())

draw_rough_arrows(8, 8.5, 5.5, 5.5, lwd = 2, 
                  hand = human_hand(seed = 1, bow = 0.05))
text(8, 9, "A pentagon", family = "Chalkboard")