Skip to content

Commit

Permalink
update compute_layer from ggplot2 source
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-glx committed Nov 30, 2023
1 parent 8f0a857 commit 1855039
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LazyData: true
Depends:
R (>= 3.2)
Imports:
cli,
ggplot2
Suggests:
viridis,
Expand Down
11 changes: 7 additions & 4 deletions R/geom_pointdensity.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ StatPointdensity <- ggproto("StatPointdensity", Stat,
args <- c(list(data = quote(data), scales = quote(scales)), params)
ggplot2:::dapply(data, "PANEL", function(data) {
scales <- layout$get_scales(data$PANEL[1])
tryCatch(do.call(self$compute_panel, args), error = function(e) {
warning(glue::glue("Computation failed in `{ggplot2:::snake_class(self)}()`:\n{e$message}"))
ggplot2:::new_data_frame()
})
rlang::try_fetch(
rlang::inject(self$compute_panel(data = data, scales = scales, !!!params)),
error = function(cnd) {
cli::cli_warn("Computation failed in {.fn {ggplot2:::snake_class(self)}}", parent = cnd)
ggplot2:::data_frame0()
}
)
})
},

Expand Down

0 comments on commit 1855039

Please sign in to comment.