Promotes an input value to a gglist. When the input includes a gg
object that uses ggforce::facet_wrap_paginate() or
ggforce::facet_grid_paginate(), the paginated plot is expanded into one
gglist element per rendered page so subsequent calls to print(),
knit_print(), or ggsave() render every page. Inputs that already
use a non-paginated facet (or no facet at all) pass through unchanged.
Details
For an input that is already a gglist, the value is returned unchanged
so the method is a no-op when nothing needs to be coerced. Call this
yourself before rendering when you want paginated facets expanded — the
render methods do not call it implicitly because page expansion is not
always desired.
Examples
p <- ggplot2::ggplot(mtcars, ggplot2::aes(mpg, wt)) + ggplot2::geom_point()
as_gglist(p)