Skip to contents

Hand-drawn uncertainty intervals at each x: geom_sketch_linerange() draws a vertical range from ymin to ymax; geom_sketch_pointrange() adds a point at y; geom_sketch_errorbar() adds end caps; geom_sketch_crossbar() draws a rough box with a line at y. Sketch analogues of ggplot2::geom_linerange() and friends. Vertical orientation only in this release.

Usage

GeomSketchLinerange

GeomSketchPointrange

GeomSketchErrorbar

GeomSketchCrossbar

geom_sketch_linerange(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  roughness = 0.7,
  bowing = 1,
  n_passes = 2L,
  seed = NULL,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

geom_sketch_pointrange(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  fatten = 4,
  roughness = 0.7,
  bowing = 1,
  n_passes = 2L,
  seed = NULL,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

geom_sketch_errorbar(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  width = 0.5,
  roughness = 0.7,
  bowing = 1,
  n_passes = 2L,
  seed = NULL,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

geom_sketch_crossbar(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  width = 0.5,
  roughness = 0.7,
  bowing = 1,
  n_passes = 2L,
  seed = NULL,
  fill_style = "solid",
  hachure_angle = 45,
  hachure_gap = NULL,
  fill_weight = 0.5,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping, data, stat, position, na.rm, show.legend, inherit.aes

Standard layer arguments.

...

Other arguments passed on to the layer. The crossbar box takes fill_roughness and fill_seed here (see geom_sketch_polygon()); geom_sketch_pointrange() takes the fill settings of geom_sketch_point() (fill_style, hachure_angle, hachure_gap, fill_weight, fill_roughness and fill_seed) for its filled shapes 21-25.

roughness, bowing, n_passes, seed

Sketch parameters.

fatten

For pointrange, multiply the point size by this factor.

width

For errorbar/crossbar, the cap/box width in data units.

fill_style, hachure_angle, hachure_gap, fill_weight

Fill parameters for the crossbar box (hachure_gap in device inches; NULL = 15% of the box's smaller drawn side, clamped to [0.04, 0.15] inches).

Value

A ggplot2 layer object.

See also

Other sketch-geoms: GeomSketchAbline, GeomSketchArrow, GeomSketchBoxplot, GeomSketchBracket, GeomSketchCallout, GeomSketchChicklet, GeomSketchCol, GeomSketchContourFilled, GeomSketchCurve, GeomSketchDotplot, GeomSketchDumbbell, GeomSketchEdge, GeomSketchEllipse, GeomSketchEngrave, GeomSketchGantt, GeomSketchHex, GeomSketchLine, GeomSketchLollipop, GeomSketchMarkCircle, GeomSketchMarkHull, GeomSketchNote, GeomSketchPath, GeomSketchPoint, GeomSketchPolygon, GeomSketchRect, GeomSketchRibbon, GeomSketchRug, GeomSketchSegment, GeomSketchSfPolygon, GeomSketchSlope, GeomSketchSmooth, GeomSketchSpoke, GeomSketchTextRepel, GeomSketchViolin, StatSketchBeeswarm, StatSketchCalendar, StatSketchDensityRidges, StatSketchFunnel, StatSketchPie, StatSketchPyramid, StatSketchRadar, StatSketchStream, StatSketchTreemap, StatSketchWaffle, StatSketchWaterfall, annotate_sketch(), annotate_sketch_arrow(), annotate_sketch_callout(), annotate_sketch_highlight(), annotate_sketch_note(), geom_sketch_alluvial(), geom_sketch_arc_diagram(), geom_sketch_bin2d(), geom_sketch_bump(), geom_sketch_chord(), geom_sketch_contour(), geom_sketch_count(), geom_sketch_dendrogram(), geom_sketch_density(), geom_sketch_density2d(), geom_sketch_ecdf(), geom_sketch_function(), geom_sketch_histogram(), geom_sketch_jitter(), geom_sketch_marimekko(), geom_sketch_mosaic(), geom_sketch_parallel(), geom_sketch_point_interactive(), geom_sketch_qq(), geom_sketch_quantile(), geom_sketch_rose(), geom_sketch_sunburst(), geom_sketch_text(), sketch_graph()

Examples

library(ggplot2)
df <- data.frame(x = c("a", "b", "c"), y = c(2, 5, 4),
                 lo = c(1, 4, 2.5), hi = c(3, 6, 5.5))
ggplot(df, aes(x, y)) +
  geom_sketch_pointrange(aes(ymin = lo, ymax = hi), seed = 1L) +
  theme_sketch()