Closed
Description
While lambda expressions are allowed in stat_function()
and a few other places, they aren't in stat_summary()
type functions. Example below. Note that the args fun.y
, fun.ymin
, and fun.ymax
are in the dev version fun
, fun.min
, and fun.max
.
library("ggplot2")
df <- data.frame(
x = c(1, 1, 2, 2, 3, 3),
y = c(0, 2, 1, 3, 2, 4)
)
ggplot(df, aes(x, y)) +
stat_summary(
fun.y = mean,
fun.ymin = function(y) mean(y) - 1,
fun.ymax = function(y) mean(y) + 1
)
ggplot(df, aes(x, y)) +
stat_summary(
fun.y = mean,
fun.ymin = ~ mean(.x) - 1,
fun.ymax = ~ mean(.x) + 1
)
#> Warning: Computation failed in `stat_summary()`:
#> 'what' must be a function or character string
Created on 2019-10-14 by the reprex package (v0.3.0)
Metadata
Metadata
Assignees
Labels
No labels