Skip to content

Commit e72d1a1

Browse files
authored
Fill in missing se parameter (#5700)
* fill in missing `se` * account for flipped aesthetics * add news bullet
1 parent f8dac9d commit e72d1a1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ggplot2 (development version)
22

3+
* The default `se` parameter in layers with `geom = "smooth"` will be `TRUE`
4+
when the data has `ymin` and `ymax` parameters and `FALSE` if these are
5+
absent. Note that this does not affect the default of `geom_smooth()` or
6+
`stat_smooth()` (@teunbrand, #5572).
37
* The bounded density option in `stat_density()` uses a wider range to
48
prevent discontinuities (#5641).
59
* `geom_raster()` now falls back to rendering as `geom_rect()` when coordinates

R/geom-smooth.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ geom_smooth <- function(mapping = NULL, data = NULL,
125125
GeomSmooth <- ggproto("GeomSmooth", Geom,
126126
setup_params = function(data, params) {
127127
params$flipped_aes <- has_flipped_aes(data, params, range_is_orthogonal = TRUE, ambiguous = TRUE)
128+
params$se <- params$se %||%
129+
if (params$flipped_aes) {
130+
all(c("xmin", "xmax") %in% names(data))
131+
} else {
132+
all(c("ymin", "ymax") %in% names(data))
133+
}
134+
128135
params
129136
},
130137

0 commit comments

Comments
 (0)