plot_spacer: Add a completely blank area

Description Usage Value Examples

View source: R/plot_spacer.R

Description

This simple wrapper creates an empty transparant patch that can be added to push your other plots apart. The patch responds to adding theme() specifications, but only plot.background will have an effect.

Usage

1

Value

A ggplot object containing an empty plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(ggplot2)

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))

p1 + plot_spacer() + p2


# To have more control over spacing, you can use the `plot.margin`
# parameter for `theme()` on each individual plot.

(p1 + theme(plot.margin = unit(c(0,30,0,0), "pt"))) +
(p2 + theme(plot.margin = unit(c(0,0,0,30), "pt")))

nmutai/patchwork documentation built on Dec. 31, 2020, 12:08 a.m.