File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -974,7 +974,8 @@ normalise_label <- function(label) {
974974 if (obj_is_list(label )) {
975975 # Ensure that each element in the list has length 1
976976 label [lengths(label ) == 0 ] <- " "
977- label <- lapply(label , `[` , 1 )
977+ truncate <- ! vapply(label , is.call , logical (1 )) # Don't mess with call/formula
978+ label [truncate ] <- lapply(label [truncate ], `[` , 1 )
978979 }
979980 if (is.expression(label )) {
980981 # Classed expressions, when converted to lists, retain their class.
Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ Position <- ggproto(
102102 # ' A data frame with completed layer data
103103 use_defaults = function (self , data , params = list ()) {
104104
105+ if (empty(data )) {
106+ return (data )
107+ }
108+
105109 aes <- self $ aesthetics()
106110 defaults <- self $ default_aes
107111
@@ -113,6 +117,13 @@ Position <- ggproto(
113117 return (data )
114118 }
115119
120+ empty_aes <- names(params )[lengths(params ) == 0 ]
121+ if (length(empty_aes ) > 0 ) {
122+ # The Geom$use_defaults method will already warn about this, we just need
123+ # to ignore this here.
124+ params <- params [setdiff(names(params ), empty_aes )]
125+ }
126+
116127 new <- compact(lapply(defaults , eval_tidy , data = data ))
117128 new [names(params )] <- params
118129 check_aesthetics(new , nrow(data ))
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ StatAlign <- ggproto(
7777
7878 finish_layer = function (data , params ) {
7979 # Silently remove out-of-bounds padding vertices
80- var <- flipped_names(params $ flipped_aes )$ x
80+ var <- flipped_names(params $ flipped_aes % || % FALSE )$ x
8181 remove <- is.na(data [[var ]]) & (data $ align_padding %|| % FALSE )
8282 vec_slice(data , ! remove )
8383 }
You can’t perform that action at this time.
0 commit comments