Skip to content

Commit c59b158

Browse files
author
Yunuuuu
committed
fix wrong parameters due to partial matching
1 parent 8b2a764 commit c59b158

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method("$",ggplot2_parameters)
34
S3method("$",ggproto)
45
S3method("$",ggproto_parent)
56
S3method("$",theme)
@@ -9,6 +10,7 @@ S3method("[",mapped_discrete)
910
S3method("[",uneval)
1011
S3method("[<-",mapped_discrete)
1112
S3method("[<-",uneval)
13+
S3method("[[",ggplot2_parameters)
1214
S3method("[[",ggproto)
1315
S3method("[[<-",uneval)
1416
S3method(.DollarNames,ggproto)

R/layer.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ layer <- function(geom = NULL, stat = NULL,
132132
params <- rename_aes(params)
133133
aes_params <- params[intersect(names(params), union(geom$aesthetics(), position$aesthetics()))]
134134
geom_params <- params[intersect(names(params), geom$parameters(TRUE))]
135+
geom_params <- new_params(geom_params)
135136
stat_params <- params[intersect(names(params), stat$parameters(TRUE))]
137+
stat_params <- new_params(stat_params)
136138

137139
ignore <- c("key_glyph", "name", "layout")
138140
all <- c(geom$parameters(TRUE), stat$parameters(TRUE), geom$aesthetics(), position$aesthetics(), ignore)
@@ -543,3 +545,11 @@ cleanup_mismatched_data <- function(data, n, fun) {
543545
data[failed] <- NULL
544546
data
545547
}
548+
549+
new_params <- function(params) structure(params, class = "ggplot2_parameters")
550+
551+
#' @export
552+
`$.ggplot2_parameters` <- function(x, i) .subset2(x, i)
553+
554+
#' @export
555+
`[[.ggplot2_parameters` <- function(x, i) .subset2(x, i)

0 commit comments

Comments
 (0)