facet_wrap_paginate_auto: Plot all ggforce::facet_wrap_paginate pages

Description Usage Arguments Value Examples

View source: R/ggplot2-helpers.R

Description

A helper function to return all pages from ggforce::facet_wrap_paginate. It automatically calculates required number of pages.

Usage

1
facet_wrap_paginate_auto(ggplot.obj, facets, nrow, ncol)

Arguments

ggplot.obj

A ggplot object

facets

Faceting formula, see facet_wrap

nrow

number of columns per page

ncol

number of rows per page

Value

A list of ggplot objects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(ggplot2)
dat <- expand.grid(x = 1:100, a = letters[1:11])
dat$y <- dat$x + rnorm(nrow(dat), 0, 10)
p <- ggplot(dat, aes(x = x, y = y)) +
  geom_point() +
  facet_wrap(~a)
p

gg <- facet_wrap_paginate_auto(p,
                               facets = formula(~a),
                               nrow = 2, ncol = 2)
gg

EarthSystemDiagnostics/ecustools documentation built on Jan. 15, 2022, 5:22 p.m.