diff --git a/DESCRIPTION b/DESCRIPTION index a01249b95..434a45801 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -80,7 +80,8 @@ Imports: later (>= 0.7.1), promises (>= 0.1.0.9001), tools, - crayon + crayon, + rlang Suggests: datasets, Cairo (>= 1.5-5), diff --git a/R/render-plot.R b/R/render-plot.R index c6b1c7e7e..9cce3c9c0 100644 --- a/R/render-plot.R +++ b/R/render-plot.R @@ -555,9 +555,11 @@ find_panel_info_api <- function(b) { # ggplot object. The original uses quoted expressions; convert to # character. mapping <- layers$mapping[[1]] - # lapply'ing as.character results in unexpected behavior for expressions - # like `wt/2`; deparse handles it correctly. - mapping <- lapply(mapping, deparse) + # In ggplot2 <=2.2.1, the mappings are expressions. In later versions, they + # are quosures. `deparse(quo_squash(x))` will handle both cases. + # as.character results in unexpected behavior for expressions like `wt/2`, + # which is why we use deparse. + mapping <- lapply(mapping, function(x) deparse(rlang::quo_squash(x))) # If either x or y is not present, give it a NULL entry. mapping <- mergeVectors(list(x = NULL, y = NULL), mapping)