patch_layout: A wrap function of plot_layout function of patchwork pkg to...

Description Usage Arguments Author(s) Examples

View source: R/patch.R

Description

A wrap function of plot_layout function of patchwork pkg to control how different plots are layed out

Usage

1
patch_layout(widths = c(5, 5), ...)

Arguments

widths

The relative widths and heights of each column and row in the grid. Will get repeated to match the dimensions of the grid.

...

other para of plot_layout function

Author(s)

Zhonghui Gai

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)
p1 + p2 + p3 + patch_annotation() + patch_layout()
library(patchwork)
(p1 | p2 | p3) + patch_annotation() + patch_layout(ncol = 3)
(p1 + patch_tag()| p2 | p3) + patch_annotation() + patch_layout(ncol = 3)
(p1 + patch_tag())/ p2 / p3 + patch_annotation() + patch_layout()
(p1 + patch_tag()) + p2 / p3 + patch_annotation() + patch_layout()
((p1 + patch_tag()) + p2) / p3 + patch_annotation() + patch_layout()
p1 + p2 + p3 + patch_annotation() + patch_layout(ncol = 3, widths = c(1,2,3))
(p1 + p2 + p3+ patch_layout( widths = c(1,2,3)))/p3 + patch_annotation()
(p1 + p2 + p3+ patch_layout( widths = c(1,2,3)))/p3 + patch_annotation() +
patch_layout(heights = c(1,2))

ZhonghuiGai/ggpatch documentation built on Dec. 18, 2021, 8:28 p.m.