modify the theme of the layout
Arguments
- theme
A
theme()object used to customize various elements of the plot, includingguides,title,subtitle,caption,margins,panel.border, andbackground. By default, the theme will inherit from the parentlayout.- ...
These dots are for future extensions and must be empty.
Details
guides,panel.border, andbackgroundwill always be used even for the nestedalignpatchesobject.title,subtitle,caption, andmarginswill be added for the top-levelalignpatchesobject only.
Examples
p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) +
geom_boxplot(aes(gear, disp, group = gear))
p3 <- ggplot(mtcars) +
geom_bar(aes(gear)) +
facet_wrap(~cyl)
align_plots(
p1 + theme(plot.background = element_blank()),
p2 + theme(plot.background = element_blank()),
p3 + theme(plot.background = element_blank())
) +
layout_annotation(
theme = theme(plot.background = element_rect(fill = "red"))
)
