hdx_geom_defaults {gghdx} | R Documentation |
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()
.
hdx_geom_defaults()
Derived from the ggthemr methods.
A list of geometry defaults.
gghdx()
for automatically setting default geometries,
along with other styling.
ggplot2_geom_defaults()
for the ggplot2 default aesthetics.
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