Skip to content

Commit eca0862

Browse files
authored
Fix blank strip text with multilayered strips (#4384)
* Subset zeroGrobs during strip assembly * Add news bullet
1 parent 1d8483a commit eca0862

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
* `stat_bin()`'s computed variable `width` is now documented (#3522).
2424

25+
* Fixed a bug in strip assembly when theme has `strip.text = element_blank()`
26+
and plots are faceted with multi-layered strips (@teunbrand, #4384).
27+
2528
* ggplot2 now requires R >= 3.3 (#4247).
2629

2730
* ggplot2 now uses `rlang::check_installed()` to check if a suggested package is

R/labeller.r

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,11 @@ build_strip <- function(label_df, labeller, theme, horizontal) {
553553
#'
554554
#' @noRd
555555
assemble_strips <- function(grobs, theme, horizontal = TRUE, clip) {
556-
if (length(grobs) == 0 || is.zero(grobs[[1]])) return(grobs)
556+
if (length(grobs) == 0 || is.zero(grobs[[1]])) {
557+
# Subsets matrix of zeroGrobs to correct length (#4050)
558+
grobs <- grobs[seq_len(NROW(grobs))]
559+
return(grobs)
560+
}
557561

558562
# Add margins to non-titleGrobs so they behave eqivalently
559563
grobs[] <- lapply(grobs, function(g) {

0 commit comments

Comments
 (0)