Skip to content

Commit 5663e3d

Browse files
authored
Fix geom_ribbon(stat = "align") dropping single groups (#6688)
* include `NA` align padding * add news bullet
1 parent 0f783ce commit 5663e3d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

NEWS.md

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

3+
* Fixed regression where `geom_area()` didn't draw panels with single groups
4+
when `stat = "align"` (@teunbrand, #6680)
35
* Fixed regression where `position_stack(vjust)` was ignored when there are
46
only single groups (#6692)
57
* Fixed bug where `NA` handling in `geom_path()` was ignoring panels (@teunbrand, #6533)

R/geom-ribbon.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ GeomRibbon <- ggproto("GeomRibbon", Geom,
124124
data <- unclass(data) #for faster indexing
125125

126126
# In case the data comes from stat_align
127-
upper_keep <- if (is.null(data$align_padding)) TRUE else !data$align_padding
127+
upper_keep <- TRUE
128+
if (!is.null(data$align_padding)) {
129+
upper_keep <- !data$align_padding
130+
# `align_padding` can be NA when group is the only group in panel
131+
upper_keep[is.na(upper_keep)] <- TRUE
132+
}
128133

129134
# The upper line and lower line need to processed separately (#4023)
130135
positions_upper <- data_frame0(

0 commit comments

Comments
 (0)