Skip to content

Commit 9cfb0b3

Browse files
authored
Make sure that expressions are reencoded as expressions when collapsed (#4418)
1 parent 1023861 commit 9cfb0b3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
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+
4+
* Fix bug in `labeller()` where parsing was turned off if `.multiline = FALSE`
5+
(@thomasp85, #4084)
6+
37
* Fix a bug in `qplot()` when supplying `c(NA, NA)` as axis limits
48
(@thomasp85, #4027)
59

R/labeller.r

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,13 @@
8888
NULL
8989

9090
collapse_labels_lines <- function(labels) {
91+
is_exp <- vapply(labels, function(l) length(l) > 0 && is.expression(l[[1]]), logical(1))
9192
out <- do.call("Map", c(list(paste, sep = ", "), labels))
92-
list(unname(unlist(out)))
93+
label <- list(unname(unlist(out)))
94+
if (all(is_exp)) {
95+
label <- lapply(label, function(l) list(parse(text = paste0("list(", l, ")"))))
96+
}
97+
label
9398
}
9499

95100
#' @rdname labellers

0 commit comments

Comments
 (0)