Skip to contents

geom_sketch_circle() draws roughened circles of radius r (data units); geom_sketch_ellipse() draws ellipses with semi-axes a (x) and b (y). Radii are in data units, so on a non-square panel a circle appears elliptical — use ggplot2::coord_equal() for true circles. These are annotation-style geoms (cf. ggforce::geom_circle()).

Usage

GeomSketchEllipse

GeomSketchCircle

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

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

Format

An object of class GeomSketchEllipse (inherits from Geom, ggproto, gg) of length 7.

An object of class GeomSketchCircle (inherits from GeomSketchEllipse, Geom, ggproto, gg) of length 3.

Arguments

mapping

Set of aesthetic mappings created by ggplot2::aes(). geom_sketch_circle() needs x, y, r; geom_sketch_ellipse() needs x, y, a, b.

data

Data to display.

stat

Statistical transformation. Default "identity".

position

Position adjustment. Default "identity".

...

Other arguments passed on to the layer.

roughness

Non-negative roughness (0 = clean). 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).

fill_style

Fill style when fill is mapped: "hachure", "cross_hatch", "zigzag", "scribble", "dots", "dashed". Default "hachure".

hachure_angle

Fill line angle in degrees. Default 45.

hachure_gap

Fill line gap (npc fraction, scaled by radius). Default 0.07.

fill_weight

Stroke weight for fill lines. Default 0.5.

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 <- data.frame(x = c(1, 3), y = c(1, 2), r = c(0.5, 1))
ggplot(df, aes(x, y, r = r)) +
  geom_sketch_circle(fill = "gold", seed = 1L) +
  coord_equal() + theme_sketch()