Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
teunbrand opened this issue May 31, 2024 · 1 comment
Closed

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

teunbrand opened this issue May 31, 2024 · 1 comment

Comments

@teunbrand
Copy link
Collaborator

teunbrand commented May 31, 2024

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?

@teunbrand
Copy link
Collaborator Author

We can just wrap facet_wrap()/facet_grid() if we need these, there is no strict need to access these internals.

facets <- facet_grid(vars(foo), vars(bar))$params[c("rows", "cols")]
facets <- facet_wrap(vars(foo, bar))$params$facets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant