Learn R Programming

ggsketch (version 2.0.0)

sketch_callout_grob: Create a sketchy callout grob (boxed label + leader arrow)

Description

Draws a handwriting label inside a roughened rounded box and a leader arrow from the box to a target point. The box auto-sizes to the label at draw time (device-space text metrics) and the leader leaves from the box edge nearest the target.

Usage

sketch_callout_grob(
  x,
  y,
  xend,
  yend,
  label,
  padding = 0.06,
  corner_radius = 0.3,
  roughness = 1,
  bowing = 0.6,
  n_passes = 2L,
  seed = NULL,
  arrow_length = NULL,
  arrow_angle = 25,
  arrow_head = NULL,
  leader = "straight",
  curvature = 0.3,
  text_gp = gpar(),
  box_gp = gpar(),
  arrow_gp = gpar(),
  name = NULL,
  vp = NULL
)

Value

A SketchCalloutGrob grob subclass.

Arguments

x, y

Box centre in npc [0,1] (scalars).

xend, yend

Target point in npc the leader points at (scalars). Pass NA for both to draw a boxed label with no leader.

label

Label text.

padding

Box padding around the text, in inches. Default 0.06.

corner_radius

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

roughness, bowing, n_passes, seed

Sketch parameters.

arrow_length, arrow_angle

Leader arrowhead size (see sketch_arrow_grob()).

arrow_head

Leader head style (see sketch_arrowheads()); NULL = the open V.

leader

Leader routing: "straight" (default), "elbow" (horizontal then vertical) or "curved" (a bowed Bezier).

curvature

Bow size when leader = "curved". Default 0.3.

text_gp, box_gp, arrow_gp

gpar()s for the label, the box (outline; its fill paints the box), and the leader.

name, vp

Passed to grid::gTree().

See Also

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