# NOT RUN {
library(dplyr)
library(ggplot2)
library(distributional)
tibble(d = dist_uniform(0, 1)) %>%
ggplot(aes(y = 0, dist = d)) +
stat_dist_slab(aes(fill_ramp = stat(x)))
tibble(d = dist_uniform(0, 1)) %>%
ggplot(aes(y = 0, dist = d)) +
stat_dist_slab(aes(fill_ramp = stat(x)), fill = "blue") +
scale_fill_ramp_continuous(from = "red")
# you can invert the order of `range` to change the order of the blend
tibble(d = dist_normal(0, 1)) %>%
ggplot(aes(y = 0, dist = d)) +
stat_dist_slab(aes(fill_ramp = stat(cut_cdf_qi(cdf))), fill = "blue") +
scale_fill_ramp_discrete(from = "red", range = c(1, 0))
# }
Run the code above in your browser using DataLab