ggeasy icon indicating copy to clipboard operation
ggeasy copied to clipboard

Feature request: `easy_panel_spacing` function

Open davidhodge931 opened this issue 2 years ago • 2 comments

Great package!

It'd be cool to have a function that easily adjusts the panel spacing.

So code that does this in an easy way.

library(palmerpenguins)
library(tidyverse)

p <- penguins |>
  ggplot() +
  geom_histogram(aes(x = flipper_length_mm)) +
  facet_grid(sex ~ species)

p + 
  theme(panel.spacing = grid::unit(1.25, "lines"))
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_bin()`).


p + 
  theme(panel.spacing.x = grid::unit(1.25, "lines"))
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_bin()`).


p +
 theme(panel.spacing.y = grid::unit(1.25, "lines"))
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_bin()`).

Created on 2023-08-24 with reprex v2.0.2

davidhodge931 avatar Aug 23 '23 21:08 davidhodge931

Thanks! This looks like a good fit - no promises on timing, but it should be entirely possible.

jonocarroll avatar Aug 24 '23 00:08 jonocarroll

Great, thanks :)

You might be interested in my package {ggblanket} - it has similar aims to ggeasy. Making ggplot2 simpler. It's not focussed on themes though, like ggeasy is - so the 2 packages work together nicely.

https://davidhodge931.github.io/ggblanket/index.html

davidhodge931 avatar Aug 24 '23 01:08 davidhodge931