Skip to contents

Draws short hand-drawn ticks along the panel edges, one per observation — the sketch analogue of ggplot2::geom_rug(). Maps the x and/or y aesthetics.

Usage

GeomSketchRug

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

Format

An object of class GeomSketchRug (inherits from Geom, ggproto, gg) of length 6.

Arguments

mapping

Set of aesthetic mappings created by ggplot2::aes().

data

Data to display.

stat

Statistical transformation (default "identity").

position

Position adjustment (default "identity").

...

Other arguments passed on to the layer.

sides

Which edges to draw on: any of "t", "r", "b", "l" combined in a string. Default "bl" (bottom + left).

length

Tick length as a fraction of the panel (npc). Default 0.03.

roughness

Non-negative roughness parameter (0 = straight). Default 1.

bowing

Non-negative bowing multiplier. Default 1.

n_passes

Number of stroke passes for the double-stroke effect. Default 2.

seed

Integer seed for reproducibility. NULL uses getOption("ggsketch.seed", 1L).

na.rm

If FALSE (default), missing values are removed with a warning.

show.legend

Logical. Should this layer be included in the legend?

inherit.aes

If FALSE, override the default aesthetics.

Value

A ggplot2 layer object.

Examples

library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
  geom_sketch_point(seed = 1L) +
  geom_sketch_rug(seed = 2L) +
  theme_sketch()