Learn R Programming

ggsketch (version 2.0.0)

sketch_repel_grob: Create a sketchy repelled-label grob

Description

Places labels near their anchors (x, y) but nudged apart so they do not overlap each other or sit on the points, via repel_layout() (run in device inches at draw time). Each displaced label is tied back to its anchor with a roughened leader line. With boxed = TRUE the labels sit in roughened rounded boxes (the geom_sketch_label_repel() look); otherwise they are bare text (the geom_sketch_text_repel() look).

Usage

sketch_repel_grob(
  x,
  y,
  label,
  boxed = FALSE,
  padding = 0.07,
  corner_radius = 0.3,
  box_padding = 0.1,
  point_padding = 0.05,
  min_segment = 0.06,
  max_iter = 2000L,
  roughness = 1,
  bowing = 0.6,
  n_passes = 2L,
  seed = NULL,
  text_gp = gpar(),
  box_gp = gpar(),
  seg_gp = gpar(),
  name = NULL,
  vp = NULL
)

Value

A SketchRepelGrob grob subclass.

Arguments

x, y

Anchor points in npc [0,1] (vectors).

label

Character labels (recycled to the anchors).

boxed

Draw each label in a rounded box? Default FALSE.

padding

Text-to-edge / text clearance, in inches. Default 0.07.

corner_radius

Box corner rounding (fraction of half-side). Default 0.3.

box_padding, point_padding

Extra clearance between boxes and around anchor points, in inches.

min_segment

Shortest leader drawn, in inches (shorter = no leader).

max_iter

Solver iteration cap. Default 2000.

roughness, bowing, n_passes, seed

Sketch parameters.

text_gp, box_gp, seg_gp

gpar()s for the text, the box, and the leader.

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_spray_grob(), sketch_stroke_grob(), sketch_wedge_grob()