tidyverse / ggplot2

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

Could `position_dodge` have a `padding` argument? #6001

Open davidhodge931 opened 2 months ago

davidhodge931 commented 2 months ago

Just as this is sometimes useful in position_dodge2, it could be useful at times in position_dodge

It would also be a way to have borders around dodged bars, and resolve issues with positioning noted in https://github.com/tidyverse/ggplot2/issues/5997

teunbrand commented 1 month ago

I think you can already specify padding using the width aesthetic and the position_dodge(width) parameter. Is there an example that is inconvenient where padding would alleviate some gnarlyness?

davidhodge931 commented 1 month ago

Ah I see, I didn't think of this! No, I can't think of an example that could not be achieved by using that method.

Still though, conceptually, if position_dodge and position_dodge2 are intended to be the same other than the grouping variable thing, then they should have the same arguments? So, either add padding to position_dodge or deprecate it from position_dodge2 if not needed. Likewise for reverse.

Feel free to close