Skip to content

Commit b791310

Browse files
committed
rename link_stat(mapping) to after.stat
1 parent 3ad38f5 commit b791310

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

R/stat-chain.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ stat_chain <- function(
6969
#' function name of the `stat_` prefix. For example, for `stat_count()`, give
7070
#' the string `"count"`.
7171
#' @param ... Other arguments passed to the stat as a parameter.
72-
#' @param mapping Set of aesthetic mappings created by [`aes()`] to be
72+
#' @param after.stat Set of aesthetic mappings created by [`aes()`] to be
7373
#' evaluated only after the stat has been computed.
7474
#'
7575
#' @seealso [stat_chain()]
@@ -79,7 +79,7 @@ stat_chain <- function(
7979
#'
8080
#' @examples
8181
#' # See `?stat_chain`
82-
link_stat <- function(stat, ..., mapping = aes()) {
82+
link_stat <- function(stat, ..., after.stat = aes()) {
8383
if (inherits(stat, "linked_stat")) {
8484
return(stat)
8585
}
@@ -94,7 +94,7 @@ link_stat <- function(stat, ..., mapping = aes()) {
9494
}
9595

9696
structure(
97-
list(stat = stat, params = params, mapping = validate_mapping(mapping)),
97+
list(stat = stat, params = params, after_stat = validate_mapping(after.stat)),
9898
class = "linked_stat"
9999
)
100100
}
@@ -140,7 +140,7 @@ StatChain <- ggproto(
140140
# TODO: ideally we'd have access to Layer$computed_mapping to properly
141141
# not touch user-specified mappings.
142142
aes <- aes[setdiff(names(aes), names(data))]
143-
aes <- compact(defaults(link$mapping, aes))
143+
aes <- compact(defaults(link$after_stat, aes))
144144
if (length(aes) == 0) {
145145
next
146146
}

man/link_stat.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-stat-chain.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test_that("stat_chain can chain multiple stats", {
1010
stats = list("unique", link_stat("bin", breaks = 0.5:3.5)),
1111
) +
1212
stat_chain(
13-
stats = list("unique", link_stat("bin", breaks = 0.5:3.5, mapping = aes(y = -count)))
13+
stats = list("unique", link_stat("bin", breaks = 0.5:3.5, after.stat = aes(y = -count)))
1414
)
1515
p <- ggplot_build(p)
1616

0 commit comments

Comments
 (0)