Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ggplot2 (development version)

* Make sure `label_bquote()` has access to the calling environment when
evaluating the labels (@thomasp85, #4141)

* Fix bug in `annotate_logticks()` that would cause an error when used together
with `coord_flip()` (@thomasp85, #3954)
Expand Down
4 changes: 3 additions & 1 deletion R/labeller.r
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ label_bquote <- function(rows = NULL, cols = NULL,
rows_quoted <- substitute(rows)
has_warned <- FALSE

call_env <- env_parent()

fun <- function(labels) {
quoted <- resolve_labeller(rows_quoted, cols_quoted, labels)
if (is.null(quoted)) {
Expand All @@ -225,7 +227,7 @@ label_bquote <- function(rows = NULL, cols = NULL,
}
params$x <- params[[1]]
}

params <- as_environment(params, call_env)
eval(substitute(bquote(expr, params), list(expr = quoted)))
}
list(do.call("Map", c(list(f = evaluate), labels)))
Expand Down