Skip to contents


This is a wraper function around patchwork::wrap_plots() and patchwork::plot_annotation() to arrange ggplot2 objects.


  nrow = NULL,
  ncol = NULL,
  widths = NULL,
  heights = NULL,
  guides = NULL,
  design = NULL,
  legend.position = "bottom",
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  tag_levels = NULL,
  tag_prefix = NULL,
  tag_suffix = NULL,
  tag_sep = NULL,
  theme = NULL



multiple ggplots or a list containing ggplot objects.

nrow, ncol

The number of rows and columns, respectively.

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.


A string specifying how guides should be treated in the layout. Defaults to 'auto'. Other possible values are 'keep' and 'collect'. In this case, will collect guides below to the given nesting level, removing duplicates.


Specification of the location of areas in the layout.


The position of the legends in the plot if guides = "collect" Default to 'bottom'.

title, subtitle, caption

Text strings to use for the various plot annotations.


A character vector defining the enumeration format to use at each level. Possible values are 'a' for lowercase letters, 'A' for uppercase letters, '1' for numbers, 'i' for lowercase Roman numerals, and 'I' for uppercase Roman numerals. It can also be a list containing character vectors defining arbitrary tag sequences. If any element in the list is a scalar and one of 'a', 'A', '1', 'i', or 'I', this level will be expanded to the expected sequence.

tag_prefix, tag_suffix

Strings that should appear before or after the tag.


A separator between different tag levels.


A ggplot theme specification to use for the plot. Only elements related to the titles as well as plot margin and background is used.


A patchwork object


# \donttest{
p1 <- ggplot(mtcars, aes(wt, mpg)) +

p2 <- ggplot(mpg, aes(class, hwy)) +

# Default plot
arrange_ggplot(p1, p2)

# Insert plot annotation, titles and subtitles
arrange_ggplot(p1, p2,
               ncol = 1,
               tag_levels = "1",
               tag_prefix = "P.",
               title = "My grouped ggplot",
               subtitle = "Made with arrange_ggplot()",
               caption = "P1 = scatter plot - P2 = boxplot")

# }