Skip to content

Commit 3026fe8

Browse files
teunbrandthomasp85
authored andcommitted
ingest plain patterns as lists in layer() (#5595)
1 parent 3d30433 commit 3026fe8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

R/geom-.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ Geom <- ggproto("Geom",
126126
deprecate_soft0("3.4.0", I("Using the `size` aesthetic in this geom"), I("`linewidth` in the `default_aes` field and elsewhere"))
127127
default_aes$linewidth <- default_aes$size
128128
}
129-
if (is_pattern(params$fill)) {
130-
params$fill <- list(params$fill)
131-
}
132129

133130
# Fill in missing aesthetics with their defaults
134131
missing_aes <- setdiff(names(default_aes), names(data))

R/layer.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ layer <- function(geom = NULL, stat = NULL,
124124

125125
all <- c(geom$parameters(TRUE), stat$parameters(TRUE), geom$aesthetics())
126126

127+
# Take care of plain patterns provided as aesthetic
128+
pattern <- vapply(aes_params, is_pattern, logical(1))
129+
if (any(pattern)) {
130+
aes_params[pattern] <- lapply(aes_params[pattern], list)
131+
}
132+
127133
# Warn about extra params and aesthetics
128134
extra_param <- setdiff(names(params), all)
129135
# Take care of size->linewidth renaming in layer params

0 commit comments

Comments
 (0)