Examples for 'patchwork::area'


Specify a plotting area in a layout

Aliases: area

Keywords:

### ** Examples

library(ggplot2)

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)

layout <- c(
  area(1, 1),
  area(1, 3, 3),
  area(3, 1, 3, 2)
)

# Show the layout to make sure it looks as it should
plot(layout)
plot of chunk example-patchwork-area-1
# Apply it to a patchwork
p1 + p2 + p3 + plot_layout(design = layout)
plot of chunk example-patchwork-area-1

[Package patchwork version 1.1.1 Index]