@@ -142,15 +142,6 @@ layer <- function(geom = NULL, stat = NULL,
142142 if (any(pattern )) {
143143 aes_params [pattern ] <- lapply(aes_params [pattern ], list )
144144 }
145- # Drop empty aesthetics
146- empty_aes <- names(aes_params )[lengths(aes_params ) == 0 ]
147- if (length(empty_aes ) > 0 ) {
148- cli :: cli_warn(
149- " Ignoring empty aesthetic{?s}: {.arg {empty_aes}}." ,
150- call = call_env
151- )
152- aes_params <- aes_params [setdiff(names(aes_params ), empty_aes )]
153- }
154145
155146 # Warn about extra params and aesthetics
156147 extra_param <- setdiff(names(params ), all )
@@ -786,6 +777,16 @@ Layer <- ggproto("Layer", NULL,
786777 # Combine aesthetics, defaults, & params
787778 if (empty(data )) return (data )
788779
780+ # Drop empty aesthetics
781+ empty_aes <- names(params )[lengths(params ) == 0 ]
782+ if (length(empty_aes ) > 0 ) {
783+ cli :: cli_warn(
784+ " Ignoring empty aesthetic{?s}: {.arg {empty_aes}}." ,
785+ call = self $ constructor
786+ )
787+ params <- params [setdiff(names(params ), empty_aes )]
788+ }
789+
789790 aesthetics <- self $ computed_mapping
790791 modifiers <- aesthetics [is_scaled_aes(aesthetics ) | is_staged_aes(aesthetics ) | is_themed_aes(aesthetics )]
791792
0 commit comments