Learn R Programming

ggalign (version 0.0.4)

layout_annotation: Modify components of the layout

Description

  • modify the theme of the layout

Usage

layout_annotation(theme = waiver(), ...)

Arguments

theme

A theme() used to render the guides, title, subtitle, caption, margins, patch.title, panel.border, and background. If NULL (default), will inherit from the parent layout.

...

These dots are for future extensions and must be empty.

Details

  • guides, patch.title, panel.border, and background will always be added even for the nested alignpatches object.

  • title, subtitle, caption, and margins will be added for the top-level alignpatches object only.

Examples

Run this code
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"))
    )

Run the code above in your browser using DataLab