Replace c(mult, add) with expansion() in scale expand args#485
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #485 +/- ##
==========================================
- Coverage 98.70% 98.66% -0.04%
==========================================
Files 35 35
Lines 5857 5857
==========================================
- Hits 5781 5779 -2
- Misses 76 78 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jgabry
left a comment
There was a problem hiding this comment.
The cleanup looks only partial to me. The direct scale_*() calls were updated to expansion(), but there are still calls to helper functions using the old numeric c(mult, add) form. Since dont_expand_y_axis() just forwards expand into scale_y_continuous(), the old-style expand is still being used indirectly.
| facet_wrap(..., labeller = label_parsed) | ||
| } | ||
| dont_expand_y_axis <- function(expand = c(0,0)) { | ||
| dont_expand_y_axis <- function(expand = expansion(0, 0)) { |
There was a problem hiding this comment.
Changing the default here is good, but there are still places in the code where we call e.g.
dont_expand_y_axis(c(0.005, 0))
in which case this is still using the old behavior.
jgabry
left a comment
There was a problem hiding this comment.
Thanks! I added a few regression tests to check the panel expansion. If everything passes we can merge.
Fixes #484
Summary
•Replaced all old-style expand = c(mult, add) numeric vector arguments with the expansion() helper across helpers-gg.R, mcmc-•diagnostics.R, mcmc-diagnostics-nuts.R, mcmc-distributions.R, and mcmc-parcoord.R
•The expansion() helper was introduced in ggplot2 3.3.0 and is the documented modern approach; the old c(mult, add) format is still supported but discouraged
•Brings these files in line with the style already used in mcmc-intervals.R and ppc-loo.R.