Skip to content

Commit 6002c9f

Browse files
committed
handle after scale errors
1 parent b35cf63 commit 6002c9f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

R/geom-.R

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,15 @@ Geom <- ggproto("Geom",
163163
# If any after_scale mappings are detected they will be resolved here
164164
# This order means that they will have access to all default aesthetics
165165
if (length(modifiers) != 0) {
166-
# Set up evaluation environment
167-
modified_aes <- eval_aesthetics(
168-
substitute_aes(modifiers), data,
169-
mask = list(stage = stage_scaled)
166+
modified_aes <- try_fetch(
167+
eval_aesthetics(
168+
substitute_aes(modifiers), data,
169+
mask = list(stage = stage_scaled)
170+
),
171+
error = function(cnd) {
172+
cli::cli_warn("Unable to apply legend modifications.", parent = cnd)
173+
data_frame0()
174+
}
170175
)
171176

172177
# Check that all output are valid data

0 commit comments

Comments
 (0)