Skip to content

Commit 4635bbb

Browse files
committed
Handle legends with null aesthetics
Fixes #2460
1 parent 039d38f commit 4635bbb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

R/geom-.r

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,13 @@ Geom <- ggproto("Geom",
110110
missing_aes <- setdiff(names(self$default_aes), names(data))
111111

112112
missing_eval <- lapply(self$default_aes[missing_aes], rlang::eval_tidy)
113+
# Needed for geoms with defaults set to NULL (e.g. GeomSf)
114+
missing_eval <- compact(missing_eval)
115+
113116
if (empty(data)) {
114-
data <- plyr::quickdf(missing_eval)
117+
data <- as.data.frame(tibble::as_tibble(missing_eval))
115118
} else {
116-
data[missing_aes] <- missing_eval
119+
data[names(missing_eval)] <- missing_eval
117120
}
118121

119122
# Override mappings with params

0 commit comments

Comments
 (0)