Skip to content

Resolve and get geom defaults

Usage

get_geom_defaults(geom, theme = theme_get())

Arguments

geom

Some definition of a geom:

  • A function that creates a layer, e.g. geom_path().

  • A layer created by such function

  • A string naming a geom class in snake case without the geom_-prefix, e.g. "contour_filled".

  • A geom class object.

theme

A theme object. Defaults to the current global theme.

Value

A list of aesthetics

Examples

# Using a function
get_geom_defaults(geom_raster)
#>        fill alpha
#> 1 #333333FF    NA

# Using a layer includes static aesthetics as default
get_geom_defaults(geom_tile(fill = "white"))
#>    fill colour linewidth linetype alpha width height
#> 1 white     NA       0.2        1    NA    NA     NA

# Using a class name
get_geom_defaults("density_2d")
#>    colour linewidth linetype alpha
#> 1 #3366FF       0.5        1    NA

# Using a class
get_geom_defaults(GeomPoint)
#>   shape colour size fill alpha stroke
#> 1    19  black  1.5   NA    NA    0.5

# Changed theme
get_geom_defaults("point", theme(geom = element_geom(ink = "purple")))
#>   shape colour size fill alpha stroke
#> 1    19 purple  1.5   NA    NA    0.5