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