Remap aesthetics after scales are applied
remap.Rd
Add this to the end of a ggbuilder pipeline to remap layer aesthetics
after the scale functions have been applied. Analogous to ggplot2::after_scale()
.
Usage
remap(x, mapping)
# S3 method for ggbuilder_layer
remap(x, mapping)
# S3 method for ggbuilder_layer_spec
remap(x, mapping)
Arguments
- x
One of:
A ggbuilder layer
A ggbuilder layer_spec
- mapping
Value
A ggbuilder layer with aesthetics provided in mapping
applied after
scales are computed, using ggplot2::after_scale()
Examples
library(ggplot2)
set.seed(123456)
df = data.frame(condition = c("A", "B", "C"), response = round(rnorm(30, 1:3), 1))
df |>
ggplot(aes(x = condition, y = response, color = condition)) +
geom_boxplot() +
stat_("boxplot", aes(y = response)) |>
geom_("label", aes(y = ymax, label = ymax)) |>
remap(aes(fill = scales::alpha(color, 0.1))) +
theme_light()
#> Warning: Duplicated aesthetics after name standardisation: NA
#> Warning: Duplicated aesthetics after name standardisation: NA