facet_wrap_paginate_auto: Plot all ggforce::facet_wrap_paginate pages

View source: R/ggplot2-helpers.R

facet_wrap_paginate_autoR Documentation

Plot all ggforce::facet_wrap_paginate pages

Description

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

Usage

facet_wrap_paginate_auto(ggplot.obj, facets, nrow, ncol, scales = "free")

Arguments

ggplot.obj

a ggplot2 object.

facets

faceting formula; see facet_wrap.

nrow

number of columns per page.

ncol

number of rows per page.

Value

A list of ggplot2 objects.

Examples

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/grfxtools documentation built on Aug. 5, 2023, 1:43 p.m.