|
1 | 1 | #' Control aesthetic evaluation
|
2 | 2 | #'
|
| 3 | +#' @description |
3 | 4 | #' Most [aesthetics][aes()] are mapped from variables found in the data.
|
4 | 5 | #' Sometimes, however, you want to delay the mapping until later in the
|
5 | 6 | #' rendering process. ggplot2 has three stages of the data that you can map
|
6 | 7 | #' aesthetics from, and three functions to control at which stage aesthetics
|
7 | 8 | #' should be evaluated.
|
8 | 9 | #'
|
9 |
| -#' @usage # These functions can be used inside the `aes()` function |
| 10 | +#' @description |
| 11 | +#' `after_stat()` replaces the old approaches of using either `stat()`, e.g. |
| 12 | +#' `stat(density)`, or surrounding the variable names with `..`, e.g. |
| 13 | +#' `..density..`. |
| 14 | +#' |
| 15 | +#' @usage |
| 16 | +#' # These functions can be used inside the `aes()` function |
10 | 17 | #' # used as the `mapping` argument in layers, for example:
|
11 | 18 | #' # geom_density(mapping = aes(y = after_stat(scaled)))
|
12 | 19 | #'
|
|
80 | 87 | #' ```
|
81 | 88 | #'
|
82 | 89 | #' ## Complex staging
|
83 |
| -#' If you want to map the same aesthetic multiple times, e.g. map `x` to a |
84 |
| -#' data column for the stat, but remap it for the geom, you can use the |
85 |
| -#' `stage()` function to collect multiple mappings. |
| 90 | +#' If you want to map the same aesthetic multiple times, e.g. map `x` to a |
| 91 | +#' data column for the stat, but remap it for the geom, you can use the |
| 92 | +#' `stage()` function to collect multiple mappings. |
86 | 93 | #'
|
87 | 94 | #' ```r
|
88 | 95 | #' # Use stage to modify the scaled fill
|
|
102 | 109 | #' fun.data = ~ round(data.frame(mean = mean(.x), sd = sd(.x)), 2)
|
103 | 110 | #' )
|
104 | 111 | #' ```
|
105 |
| -#' @note |
106 |
| -#' `after_stat()` replaces the old approaches of using either `stat()`, e.g. |
107 |
| -#' `stat(density)`, or surrounding the variable names with `..`, e.g. |
108 |
| -#' `..density..`. |
109 | 112 | #' @rdname aes_eval
|
110 | 113 | #' @name aes_eval
|
111 | 114 | #'
|
|
0 commit comments