V1.5.0 of bayesplot package released (+ blog post)

Version 1.5.0 of the bayesplot R package is now available from CRAN. Release notes are copied below and available at mc-stan.org/bayesplot/news.


After CRAN binaries are built (usually a few days) just use install.packages("bayesplot"). Before binaries are available the update can be installed from CRAN using

install.packages("bayesplot", type = "source", repos = "https://cran.rstudio.com/")

or from GitHub using

# note: setting build_vignettes=FALSE will be much faster and you can always access 
# the vignettes at mc-stan.org/bayesplot/articles/

devtools::install_github("stan-dev/bayesplot", ref = "v1.5.0", build_vignettes = TRUE) 

Release notes

(GitHub issue/PR numbers in parentheses)

  • New package documentation website: http://mc-stan.org/bayesplot/

  • Two new plots that visualize posterior density using ridgelines (ggridges pkg). These work well when parameters have similar values and similar densities, as in hierarchical models. (#104)

    • mcmc_dens_chains() draws the kernel density of each sampling chain.
    • mcmc_areas_ridges() draws the kernel density combined across chains.
    • Both functions have a corresponding _data() function to return the data plotted by
      each function.
  • mcmc_intervals() and mcmc_areas() have been rewritten. (#103)

    • They now use a discrete y-axis. Previously, they used a continuous
      scale with numeric breaks relabelled with parameter names; this design
      caused some unexpected behavior when customizing these plots.
    • mcmc_areas() now uses geoms from the ggridges package to draw density
  • Added mcmc_intervals_data() and mcmc_areas_data() that return data
    plotted by mcmc_intervals() and mcmc_areas(). Similarly, ppc_data()
    returns data plotted ppc_hist() and other ppc plot. (Advances #97)

  • Added ppc_loo_pit_overlay() function for a better LOO PIT predictive check.

  • Started using vdiffr to add visual unit tests to the existing PPC unit tests. (#137)

Note: we plan to address the issue of setting the global ggplot theme in one of the next releases.


Also, my bayesplot coauthor @tjmahr has put out a nice blog post giving a behind the scenes look at how he implemented the new ridgelines plots in bayesplot v1.5.0:

And for anyone interested in “tidy” data, TJ has been adding functions to bayesplot for returning the data used for plotting in a tidy format. These functions have the same names as the plotting functions but end with the suffix _data and return a tidy data frame. We don’t have these for every plot yet but over the past few releases we’ve already incorporated a decent number of them.