Graphical parameters for `geom_smooth()` band
This PR aims to fix #6551.
Briefly, we allow setting the colour/linetype/linewidth of the confidence bands in geom_smooth().
A demonstration:
devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2
ggplot(mpg, aes(displ, hwy, fill = drv)) +
geom_smooth(
band.colour = "black",
band.linetype = 3,
band.linewidth = 0.5
)
#> `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Created on 2025-09-26 with reprex v2.1.1
That's right. Do you think missing parameters should be drawn from the central line?
That is how we do it for the others, right? NULL means don't draw, NA means inherit..?
I think the meaning of NULL and NA are swapped. The main reason I initially didn't take properties from the central line was because it should be hidden by default. Of course we might achieve that by setting transparent colours, 0 linewidth or blank linetypes.
oh, yeah you are right... Then just default the arguments to NA to ensure default is not to draw, and let NULL mean inherit
I'm now hiding it with band.linetype = "blank". Activating the band lines requires setting a non-blank linetype.
devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2
ggplot(mpg, aes(displ, hwy)) +
geom_smooth(band.linetype = 1, linetype = 2)
#> `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

band.linetype = NULL inherits from center line.
ggplot(mpg, aes(displ, hwy)) +
geom_smooth(band.linetype = NULL, linetype = 2)
#> `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Created on 2025-12-04 with reprex v2.1.1