tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.48k stars 2.02k forks source link

Encapsulate or export `{wrap/grid}_as_facets_list()`. #5925

Open teunbrand opened 4 months ago

teunbrand commented 4 months ago

For relatively straightforward facet extensions that borrow the grid/wrap layout structure (but don't directly re-use the facet_wrap()/facet_grid() constructors), it would be convenient to access the wrap_as_facets_list() and grid_as_facets_list() functions. It is notoriously inconvenient to copy over these functions because they depend on a cascade of internal functions that also would need to be copied.

This cascade can be visualised as follows:

flow::flow_view_deps(ggplot2:::wrap_as_facets_list)
flow::flow_view_deps(ggplot2:::grid_as_facets_list)

For grid_as_facets_list():

image

If these are not suitable for export to users, could we encapsulate them in the ggproto classes so that they are accessible to extension developers?