diff --git a/NEWS.md b/NEWS.md index c7df5f90cf..3f5d1cb766 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # ggplot2 (development version) +* Fixed regression where `geom_area()` didn't draw panels with single groups + when `stat = "align"` (@teunbrand, #6680) * Fixed regression where `position_stack(vjust)` was ignored when there are only single groups (#6692) * Fixed bug where `NA` handling in `geom_path()` was ignoring panels (@teunbrand, #6533) diff --git a/R/geom-ribbon.R b/R/geom-ribbon.R index 805f0c6aa9..8816b44d9b 100644 --- a/R/geom-ribbon.R +++ b/R/geom-ribbon.R @@ -124,7 +124,12 @@ GeomRibbon <- ggproto("GeomRibbon", Geom, data <- unclass(data) #for faster indexing # In case the data comes from stat_align - upper_keep <- if (is.null(data$align_padding)) TRUE else !data$align_padding + upper_keep <- TRUE + if (!is.null(data$align_padding)) { + upper_keep <- !data$align_padding + # `align_padding` can be NA when group is the only group in panel + upper_keep[is.na(upper_keep)] <- TRUE + } # The upper line and lower line need to processed separately (#4023) positions_upper <- data_frame0(