ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

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

Open davidhodge931 opened this issue 1 year ago • 2 comments

I find it a bit confusing having the strip.position/switch argument in facet_wrap/facet_grid that does pretty much the same thing.

An idea to make these consistent is to deprecate the switch argument in facet_grid, and add in a strip.position argument for users to use instead.

Where in a grid of 2 facet variables, a character vector of 2 could be provided with "top"/"bottom" always controlling the x, and "left"/"right" would always controlling the y.

Also, It'd be cool if for the grid, it didn't matter which way around you specify the vector - as it would always know top/bottom relates to cols facet variable and right/left to the rows facet variable.

penguins |> 
   ggplot() +
   geom_point(aes(x = flipper_length_mm, y = body_mass_g)) +
   facet_grid(.~species, strip.position = "bottom")
 
 penguins |> 
   ggplot() +
   geom_point(aes(x = flipper_length_mm, y = body_mass_g)) +
   facet_grid(sex~species, strip.position = c("bottom", "left"))

davidhodge931 avatar Jul 12 '24 22:07 davidhodge931