Closed aijordan closed 6 days ago
This PR is a recreation of #4560 (which can no longer be reopened) and addresses the initial issue discussed in #4561
(Not addressed: rlang lambda function notation for breaks and binwidth)
breaks
binwidth
The changes allow the breaks argument of stat_bin() to take functions as input. Example:
stat_bin()
library(ggplot2) df <- data.frame( x = c(rexp(1000), rexp(1000, 5)), study = c(rep("A", 1000), rep("B", 1000)) ) ggplot(df, aes(x)) + geom_histogram( mapping = aes(y = after_stat(density)), breaks = \(x) qexp(c(0, .25, .5, .75, .95, .99), 1/mean(x)) ) + facet_wrap(vars(study))
Created on 2024-06-28 with reprex v2.1.0
Awesome, thank you for the contribution!
This PR is a recreation of #4560 (which can no longer be reopened) and addresses the initial issue discussed in #4561
(Not addressed: rlang lambda function notation for
breaks
andbinwidth
)The changes allow the
breaks
argument ofstat_bin()
to take functions as input. Example:Created on 2024-06-28 with reprex v2.1.0