From 689204f2b3c33732502e79e7d59551756174333b Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Mon, 18 Dec 2023 12:31:11 +0100 Subject: [PATCH] ingest plain patterns as lists in `layer()` --- R/geom-.R | 3 --- R/layer.R | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/R/geom-.R b/R/geom-.R index 6d4ed6fc55..0b22c1ab03 100644 --- a/R/geom-.R +++ b/R/geom-.R @@ -126,9 +126,6 @@ Geom <- ggproto("Geom", deprecate_soft0("3.4.0", I("Using the `size` aesthetic in this geom"), I("`linewidth` in the `default_aes` field and elsewhere")) default_aes$linewidth <- default_aes$size } - if (is_pattern(params$fill)) { - params$fill <- list(params$fill) - } # Fill in missing aesthetics with their defaults missing_aes <- setdiff(names(default_aes), names(data)) diff --git a/R/layer.R b/R/layer.R index eb590f8dea..02649348ac 100644 --- a/R/layer.R +++ b/R/layer.R @@ -124,6 +124,12 @@ layer <- function(geom = NULL, stat = NULL, all <- c(geom$parameters(TRUE), stat$parameters(TRUE), geom$aesthetics()) + # Take care of plain patterns provided as aesthetic + pattern <- vapply(aes_params, is_pattern, logical(1)) + if (any(pattern)) { + aes_params[pattern] <- lapply(aes_params[pattern], list) + } + # Warn about extra params and aesthetics extra_param <- setdiff(names(params), all) # Take care of size->linewidth renaming in layer params