Skip to contents

Draws line segments from (x, y) at a given angle (radians) and radius — the sketch analogue of ggplot2::geom_spoke(). Handy for vector / flow fields. Internally reuses GeomSketchSegment.

Usage

GeomSketchSpoke

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

Format

An object of class GeomSketchSpoke (inherits from GeomSketchSegment, Geom, ggproto, gg) of length 4.

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.

radius, angle

Optional fixed radius / angle (radians) used when not supplied as aesthetics.

roughness

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

bowing

Non-negative bowing multiplier. Default 1.

n_passes

Number of stroke passes. Default 2.

seed

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

na.rm

Remove missing values silently? Default FALSE.

show.legend

Logical; include in legend?

inherit.aes

Override default aesthetics?

Value

A ggplot2 layer object.

Examples

library(ggplot2)
df <- expand.grid(x = 1:5, y = 1:5)
df$angle <- runif(nrow(df), 0, 2 * pi)
df$radius <- 0.5
ggplot(df, aes(x, y)) +
  geom_sketch_spoke(aes(angle = angle, radius = radius), seed = 1L) +
  geom_sketch_point(seed = 2L) +
  theme_sketch()