Skip to contents

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 into a patchwork
Create an inset to be added on top of the previous plot

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.

Define the grid to compose plots in
Annotate the final patchwork
Add a completely blank area
Free a plot from alignment
Add an area to hold collected guides
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 arbitrary graphics in a patchwork-compliant patch
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