Stickers, people, templates and diagrams

Stickers

Twelve community libraries from https://libraries.excalidraw.com come with the package. Stickers are native Excalidraw elements: hand-drawn, editable, and recolourable.

table(exc_stickers()$library)
#> 
#>       bubbles  data-science      data-viz        emojis        hearts 
#>             4             7            32            48             5 
#>         icons       r-icons         signs         stars stick-figures 
#>            24             2             2            12             9 
#>  sticky-notes  storytelling 
#>            13            16
exc_sticker_sheet("stick-figures", columns = 5) |> plot()

A sheet of hand-drawn stick figures in five columns, each with its name

exc_scene(exc_text("Sticker party", 0, 0, font_size = 36)) |>
  exc_sticker("stick-figures:Girl", 0, 60, width = 90) |>
  exc_sticker("r-icons:1", 120, 70, width = 90) |>
  exc_sticker("bubbles:1", 230, 50, width = 160) |>
  exc_sticker("stars:3", 420, 70, width = 70, stroke = "#f08c00", fill = "#ffec99",
              fill_style = "solid") |>
  plot()

The title Sticker party above a stick-figure girl, an R logo, a speech bubble and an orange star

Any other library works too: exc_library("https://...excalidrawlib") and exc_library_item().

Hand-drawn people

exc_peep() draws people in Pablo Stanley’s Open Peeps style. Each seed is a different person; see exc_peep_options() for faces, heads and accessories.

exc_scene() |>
  exc_peep(0, 0, seed = "Ada", face = "smile") |>
  exc_peep(170, 0, seed = "Grace", clothing = "#a5d8ff") |>
  exc_peep(340, 0, seed = "Hadley", face = "cheeky") |>
  plot()

Three hand-drawn Open Peeps people side by side, one smiling, one in a light blue top, one with a cheeky face

Templates

Design a card or poster in Excalidraw, with {{column}} in its text, and shapes labelled {{chart:name}} or {{image:name}} where charts and images should go. Then fill it from data:

card <- exc_template_fill(
  exc_template_example(),
  data = list(metric = "Sketches drawn", value = "1,204", change = "+18% this month"),
  charts = list(trend = ggplot(data.frame(x = 1:12, y = c(3, 4, 4, 6, 5, 7, 8, 8, 9, 11, 10, 12)),
                               aes(x, y)) + geom_line(linewidth = 1, colour = "#1971c2") +
                  labs(x = NULL, y = NULL) + theme_excalidraw(base_size = 11))
)
plot(card)

A hand-drawn KPI card reading Sketches drawn, 1,204, +18% this month, with a small rising line chart

exc_template_render() does this for every row of a data frame and saves one file per row.

Diagrams

exc_mermaid() converts Mermaid text into editable Excalidraw shapes with Excalidraw’s own converter (it needs Chrome, through the chromote package). exc_d2() renders D2 diagrams in D2’s sketch mode, if the d2 program is installed.

exc_mermaid("flowchart LR\n  A[Data] --> B[Sketch it] --> C[Share]") |> plot()
exc_d2("data -> sketch -> share") |> plot()

Drawings that draw themselves

exc_animate() saves a scene as an SVG that sketches itself, element by element in z-order: strokes are traced, fills fade in after their outline and text is written letter by letter. The SVG plays in any browser, also as an <img> in a web page, slide or README.

chart <- as_excalidraw(ggplot(mpg, aes(class)) + geom_bar())
svg <- tempfile(fileext = ".svg")
exc_animate(chart, svg, duration = 5, loop = TRUE)
A bar chart drawing itself

Save to .gif to record the animation in headless Chrome instead (it needs the chromote package, and gifski or magick to put the frames together):

exc_animate(chart, "chart.gif", loop = TRUE)

More fonts

exc_fonts()
#>                   name excalidraw_id bundled license
#> 1               Virgil             1    TRUE OFL-1.1
#> 2            Helvetica             2   FALSE  system
#> 3             Cascadia             3    TRUE OFL-1.1
#> 4           Excalifont             5    TRUE OFL-1.1
#> 5               Nunito             6    TRUE OFL-1.1
#> 6           Lilita One             7    TRUE OFL-1.1
#> 7         Comic Shanns             8    TRUE     MIT
#> 8      Liberation Sans             9   FALSE  system
#> 9               Caveat            NA    TRUE OFL-1.1
#> 10        Patrick Hand            NA    TRUE OFL-1.1
#> 11 Architects Daughter            NA    TRUE OFL-1.1
#> 12          Gochi Hand            NA    TRUE OFL-1.1

exc_font_fetch("xkcd") downloads the xkcd Script font (non-commercial licence) for font = "xkcd Script".

Sketch Studio

run_sketch_studio() puts all of this behind a point-and-click app, around the live Excalidraw editor.