Plot Composition

At the heart of patchwork lies a range of powerful functions for combining plots into an assembly of plots that can be layed out in a grid. Patchwork provides both an extension of ggplot2’s + based API, along with a functinal interface.

`-`(<ggplot>) `/`(<ggplot>) `|`(<ggplot>) `*`(<gg>) `&`(<gg>)

Plot arithmetic

wrap_plots()

Wrap plots into a patchwork

Layout Specifications

While patchwork will automatically lay out the plots in a grid, additional control is often needed, along with the possibility of adding annotations etc.

plot_layout()

Define the grid to compose plots in

plot_annotation()

Annotate the final patchwork

plot_spacer()

Add a completely blank area

guide_area()

Add an area to hold collected guides

area()

Specify a plotting area in a layout

Alternative plot objects

patchwork is build to work with ggplot2 but standard grobs can also be included. Further, it is possible to define empty areas if needed.

wrap_elements()

Wrap arbitrary graphics in a patchwork-compliant patch

wrap_ggplot_grob()

Make a gtable created from a ggplot object patchwork compliant

Align across pages

Sometimes it is necessary to align plots across pages, not within a composition, e.g. when creating figures for presentations. While not the main focus of patchwork, it still contains the necessary infrastructure to achieve this.

get_dim() set_dim() get_max_dim() align_patches()

Align plots across multiple pages