-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
In the previous version, I believe it was possible to use rep() within ggplot2::margin() to set margins to all be the same value. This seems to no longer be possible. Is this change deliberate? It was handy when wanting to create margins based on the base text size argument of a custom theme function, for example (e.g plot.margin = margin(rep(base_text_size * 1.5, 4))
)
# This plot has no margins
babynames::babynames |>
dplyr::filter(name %in% c("Mary", "Hannah"), sex == "F") |>
ggplot(aes(x = year, y = n, group = name, color = name)) +
geom_line() +
theme(plot.margin = margin(rep(20, 4)))
# This plot does have margins
babynames::babynames |>
dplyr::filter(name %in% c("Mary", "Hannah"), sex == "F") |>
ggplot(aes(x = year, y = n, group = name, color = name)) +
geom_line() +
theme(plot.margin = margin(20, 20, 20, 20))
Metadata
Metadata
Assignees
Labels
No labels