Skip to content

Commit e1712b9

Browse files
committed
Improve example
1 parent b109e9f commit e1712b9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

R/aes-evaluation.r

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,15 @@
9090
#' ggplot(mpg, aes(class, hwy)) +
9191
#' geom_boxplot(aes(fill = stage(class, after_scale = alpha(fill, 0.4))))
9292
#'
93-
#' # Using data for computing summary, but placing label elsewhere, as well as
94-
#' # using the computed 'y' as part of the label.
93+
#' # Using data for computing summary, but placing label elsewhere.
94+
#' # Also, we're making our own computed variable to use for the label.
9595
#' ggplot(mpg, aes(class, displ)) +
9696
#' geom_violin() +
9797
#' stat_summary(
9898
#' aes(y = stage(displ, after_stat = 8),
99-
#' label = after_stat(paste(y, ymax, sep = " ± "))),
99+
#' label = after_stat(paste(mean, "±", sd))),
100100
#' geom = "text",
101-
#' fun = ~ round(mean(.x), 2),
102-
#' fun.max = ~ round(sd(.x), 2)
101+
#' fun.data = ~ round(data.frame(mean = mean(.x), sd = sd(.x)), 2)
103102
#' )
104103
#' ```
105104
#'

0 commit comments

Comments
 (0)