View source: R/ggplot2-helpers.R
facet_wrap_paginate_auto | R Documentation |
A helper function to return all pages from ggforce::facet_wrap_paginate. It automatically calculates the required number of pages.
facet_wrap_paginate_auto(ggplot.obj, facets, nrow, ncol, scales = "free")
ggplot.obj |
a ggplot2 object. |
facets |
faceting formula; see |
nrow |
number of columns per page. |
ncol |
number of rows per page. |
A list of ggplot2 objects.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.