Learn R Programming

ggsketch (version 2.0.0)

sketch_stroke_grob: Create a variable-width sketch stroke grob

Description

A grid grob that draws its path as a tapered / pressure-varying hand-drawn stroke. Unlike sketch_path_grob() (constant-lwd polylines), the line is built from stroke_ribbon() polygons, so it can taper to a point, swell with pressure, or vary like a broad calligraphic nib. Coordinates are npc [0,1]; roughening and offsetting happen in device inches inside makeContent().

Usage

sketch_stroke_grob(
  x,
  y,
  id = NULL,
  width = 0.03,
  roughness = 1,
  bowing = 1,
  n_passes = 2L,
  seed = NULL,
  taper = "none",
  taper_frac = 0,
  pressure = NULL,
  nib_angle = NULL,
  jitter_w = 0,
  cap = "round",
  gp = gpar(),
  name = NULL,
  vp = NULL
)

Value

A SketchStrokeGrob (a grid grob subclass).

Arguments

x, y

Numeric vectors of npc [0,1] coordinates.

id

Integer vector grouping coordinates into separate strokes (same semantics as sketch_path_grob()). NULL treats all points as one stroke.

width

Full stroke width in inches. Default 0.03.

roughness, bowing, n_passes, seed

Sketch parameters for the centreline.

taper, taper_frac, pressure, nib_angle, jitter_w, cap

Passed to stroke_ribbon().

gp

A grid::gpar(); its col becomes the ribbon fill (the ribbon is painted, not stroked), alpha is honoured.

name, vp

Passed to grid::gTree().

See Also

Other grob-layer: sketch_arrow_grob(), sketch_band_grob(), sketch_callout_grob(), sketch_dotplot_grob(), sketch_ellipse_grob(), sketch_engrave_grob(), sketch_path_grob(), sketch_polygon_grob(), sketch_repel_grob(), sketch_spray_grob(), sketch_wedge_grob()