ASKurz / Doing-Bayesian-Data-Analysis-in-brms-and-the-tidyverse

The bookdown version lives here: https://bookdown.org/content/3686
GNU General Public License v3.0
148 stars 43 forks source link

stat_histintervalh() #13

Closed ASKurz closed 4 years ago

ASKurz commented 4 years ago

Based on the current dev version of tidybayes, this now works:

library(tidyverse)
library(tidybayes)

set.seed(1)
tibble(x = rnorm(1e5)) %>% 
  ggplot(aes(x = x, y = 0)) +
  stat_histintervalh(point_interval = mode_hdi, .width = .95,
                     fill = "grey67", slab_color = "grey92",
                     breaks = 40, slab_size = .25, outline_bars = T) +
  theme(panel.grid = element_blank())

Or use

stat_histintervalh(point_interval = mode_hdi, .width = .95,
                     fill = "grey67", slab_color = "grey92",
                     breaks = 40, slab_size = .25, outline_bars = T,
                     normalize = "xy") +

For more, see issue #222.