View source: R/alignpatch-align_plots.R
layout_design | R Documentation |
To control how different plots are laid out, you need to add a layout design specification. If you are nesting grids, the layout is scoped to the current nesting level.
layout_design(
ncol = waiver(),
nrow = waiver(),
byrow = waiver(),
widths = waiver(),
heights = waiver(),
design = waiver(),
guides = NA
)
ncol , nrow |
The dimensions of the grid to create - if both are |
byrow |
If |
widths , heights |
The relative widths and heights of each column and row
in the grid. Will get repeated to match the dimensions of the grid. The
special value of |
design |
Specification of the location of areas in the layout. Can
either be specified as a text string or by concatenating calls to
|
guides |
A string with one or more of |
A layout_design
object.
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, p2, p3) +
layout_design(nrow = 1L)
align_plots(p1, p2, p3) +
layout_design(ncol = 1L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.