Skip to contents

A re-export of vellum::sketch() — the one vocabulary vellumplot speaks for the hand-drawn look (wobbly outlines, hachure fills, à la Rough.js). Pass a sketch() value to any mark's sketch = argument, to an element_line() / element_rect() sketch = slot, or set it plot-wide with theme_sketch():

Usage

sketch(
  roughness = 1,
  bowing = 1,
  fill_style = c("hachure", "solid", "crosshatch", "zigzag", "dots"),
  fill_weight = NULL,
  hachure_angle = -41,
  hachure_gap = NULL,
  curve_tightness = 0,
  disable_multi_stroke = FALSE,
  preserve_vertices = FALSE,
  seed = 1L
)

Arguments

roughness

Wobble amount (>= 0; 0 is nearly crisp, 1 the default, higher is wilder).

bowing

How much straight edges bow.

fill_style

One of "hachure", "solid", "crosshatch", "zigzag", "dots".

fill_weight, hachure_angle, hachure_gap, curve_tightness, disable_multi_stroke, preserve_vertices, seed

Further tuning; see vellum::sketch().

Value

A vellum_sketch object.

Details

vplot(mpg) |> mark_point(x = displ, y = hwy, sketch = sketch(roughness = 1.2))

Sketch is a geometry property, not a layer effect: it perturbs the mark itself (its wobble is generated natively in the vellum engine, so it is exact, cross-backend, and works in PDF), rather than compositing extra copies. Text is never sketched — pair a handwriting family with it for a fully hand-drawn plot.

Resolution is most-specific-wins: a mark's sketch = beats an element slot, which beats the plot-wide theme_sketch() default. At any level sketch = NA (or FALSE) forces that element crisp, overriding a broader default; sketch = NULL inherits.

Examples

vplot(mtcars) |>
  mark_point(x = wt, y = mpg, sketch = sketch(roughness = 1.5, seed = 7))