Learn R Programming

gghdx (version 0.1.4)

hdx_geom_defaults: Default HDX geometry aesthetics

Description

Default geometry aesthetics fitting the HDX design guide. Used in gghdx() to set default fill, color, size, and point geometry defaults, which is not possible using just theme_hdx().

Usage

hdx_geom_defaults()

Arguments

Value

A list of geometry defaults.

Details

Derived from the ggthemr methods.

See Also

  • gghdx() for automatically setting default geometries, along with other styling.

  • ggplot2_geom_defaults() for the ggplot2 default aesthetics.

Examples

Run this code
library(purrr)
library(ggplot2)

# updating geom defaults (like default color of a point or fill for bar)
purrr::walk(
  hdx_geom_defaults(),
  ~ do.call(what = ggplot2::update_geom_defaults, args = .),
)

p <- ggplot(mtcars) +
  geom_point(
    aes(
      x = mpg,
      y = hp
    )
  )

# see the points are automatically in HDX sapphire
p

# need to reset back to the default geometries
purrr::walk(
  ggplot2_geom_defaults(),
  ~ do.call(what = ggplot2::update_geom_defaults, args = .)
)

# now the points are back to default black
p

Run the code above in your browser using DataLab