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

POC: replace facet_grid(switch) with strip.position #6161

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5999.

Briefly, it deprecates facet_grid(switch) in favour of facet_grid(strip.position = "top"/"bottom"/"left"/"right").

If one of the directions is omitted (top/bottom in example below), the default will be filled in:

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point()

p + facet_grid(
  drv ~ year,
  strip.position = "left"
)

However, when specifying >1 position in the same direction, this taken literally.

p + facet_grid(
  drv ~ year,
  strip.position = c("top", "bottom", "left", "right")
)

Created on 2024-10-25 with reprex v2.1.1

It is currently a POC because I'm unsure of whether we should do this. Reverse dependency checks revealed a lot of facet extensions that are rather sensitive to parameters in facet_grid()/facet_wrap() when implementing #5855. For this reason, I expect some revdep troubles with this PR. In contrast to #5855, which adds new functionality, this PR is mostly 'cosmetic'.

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

Successfully merging this pull request may close these issues.

In facet_grid, could the switch argument be deprecated, and replaced with a strip.position argument?
1 participant