Skip to content

Commit f64a845

Browse files
committed
adapt examples
1 parent 495c7fa commit f64a845

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

R/stat-chain.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,19 @@
3737
#' p + stat_chain(stats = c("unique", "bin"))
3838
#' # Controlling parameters
3939
#' p + stat_chain(
40-
#' stats = c("unique", "bin"),
41-
#' stat.params = list(NULL, list(bins = 10))
40+
#' stats = list("unique", link_stat("bin", bins = 10))
4241
#' )
4342
#' # Evaluate expressions after computing stats
43+
#' p + stat_chain(stats = list(
44+
#' link_stat("unique", after.stat = aes(x = x + 1)),
45+
#' link_stat("density", after.stat = aes(y = density))
46+
#' ))
47+
#' # Note that the last `after.stat` argument serves the same role as the
48+
#' # `after_stat()` function in the layer mapping, so the following is
49+
#' # equivalent to the previous plot
4450
#' p + stat_chain(
45-
#' stats = c("unique", "bin"),
46-
#' redirect = list(aes(x = x + 1), aes(y = density))
51+
#' mapping = aes(y = after_stat(density)),
52+
#' stats = list(link_stat("unique", after.stat = aes(x = x + 1)), "density")
4753
#' )
4854
stat_chain <- function(
4955
mapping = NULL,

man/stat_chain.Rd

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

0 commit comments

Comments
 (0)