match_geom_args: Match list of arguments to arguments of geometry

Description Usage Arguments Value Examples

View source: R/geometries.R

Description

Match list of arguments to arguments of geometry

Usage

1
2
3
4
5
6
7
match_geom_args(
  geom,
  args,
  add_aes = TRUE,
  mapping = list(),
  envir = "ggplot2"
)

Arguments

geom

Character. name of the geometry.

args

Named list, parameters to be matched to the geometry arguments.

add_aes

Add aesthetics parameters (like size, fill, ...).

mapping

Mapping used in plot, to avoid setting fixed aesthetics parameters.

envir

Package environment to search in.

Value

a list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# List of parameters
params <- list(
  bins = 30,
  scale = "width",
  adjust = 2,
  position = "stack",
  size = 1.6,
  fill = "#112246"
)

# Search arguments according to geom
match_geom_args(geom = "histogram", args = params)
match_geom_args(geom = "violin", args = params)
match_geom_args(geom = "bar", args = params, add_aes = FALSE)
match_geom_args(geom = "point", args = params)
match_geom_args(geom = "point", args = params, add_aes = FALSE)

singha53/esquisse documentation built on Dec. 23, 2021, 2:29 a.m.