Plotting for Bayesian Models
Overview
Plotting functions for posterior analysis, MCMC diagnostics, prior and posterior predictive checks, and other visualizations to support the applied Bayesian workflow advocated in Gabry, Simpson, Vehtari, Betancourt, and Gelman (2019) doi:10.1111/rssa.12378. The package is designed not only to provide convenient functionality for users, but also a common set of functions that can be easily used by developers working on a variety of R packages for Bayesian modeling, particularly (but not exclusively) packages interfacing with 'Stan'.
New plots and plotting capabilities
mcmc_dots()andmcmc_dots_by_chain()are new quantile dot plots for MCMC draws. All dot-plot functions now default toquantiles = 100. @behramulukir (#402)ppc_calibration()and the new grouped, overlay, LOO, and_data()variants provide calibration plots for models with binary outcomes. @TeemuSailynoja and @florence-bockting (#352)ppc_loo_pit_ecdf(),ppc_pit_ecdf(), andppc_pit_ecdf_grouped()gainmethod = "correlated"for dependence-aware uniformity tests and visualization of influential ECDF regions. The existing"independent"method remains the default but is superseded. @florence-bockting (#428)
Show all changes in 1.16.0Hide the rest of the changes in 1.16.0
ppc_rootogram_grouped()is a new grouped and faceted rootogram supporting all existing rootogram styles. @behramulukir and @jgabry (#419)ppd_*()distribution and test-statistic functions gainshow_marginalfor adding the marginal predictive distribution; defaults are unchanged. @mattansb (#425)
Other improvements and behavior changes
mcmc_areas(),mcmc_areas_ridges(),mcmc_dens(),mcmc_dens_chains(), andmcmc_dens_overlay()gain aboundsargument for bounded density estimation, as do their_data()companions and the PPC and PPD density functions. @VisruthSK (#317)mcmc_trace()now officially supports thehighlightandalphaarguments for highlighting a chain with lines. @jgabry (#552)ppc_*()andppd_*()functions now acceptposterior::drawsobjects for predictive draws. @ishaan-arora-1 (#542)ppc_ecdf_overlay(),ppc_ecdf_overlay_grouped(), andppd_ecdf_overlay()now always draw ECDFs as step functions; theirdiscreteargument is deprecated. @utkarshpawade (#259)prepare_mcmc_array()now warns rather than errors when draws containNAs, allowing MCMC plots of ragged arrays padded with missing values. It also rejects unequal chain lengths and mismatched parameter names that could previously corrupt or misalign draws. @utkarshpawade (#250, #498, #528)
Bug fixes and compatibility
- Improved compatibility with ggplot2 4.0 and current dplyr and tidyselect releases, eliminating deprecation and small-group warnings and fixing linetype legends. @jgabry, @BjarkeHautop, @ishaan-arora-1, and @utkarshpawade (#410, #412, #414, #442, #446, #448, #450, #458, #468)
mcmc_pairs()now correctly marks divergences and maximum-treedepth hits in every panel; a regression introduced in bayesplot 1.10.0 could omit or misassign them. @jgabry (#555)nuts_params()preserves array dimensions when a single parameter is selected from aCmdStanMCMCobject and gives clear errors for empty or zero-row list inputs. @utkarshpawade (#530, #534)ppc_loo_pit_data()now validates user-suppliedpitvalues at the entry point and rejects nonnumeric, missing, or out-of-range inputs. @utkarshpawade (#503)
There were many other non user-facing changes, including internal refactoring
and improved test coverage. The full changelog can be found at:
https://github.com/stan-dev/bayesplot/compare/v1.15.0...v1.16.0
From NEWS.md in the release
Install
Health
ERRORtestsr-oldrel-macos-arm64
Running ‘testthat.R’ [78s/79s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(bayesplot)
This is bayesplot version 1.16.0
- Online documentation and vignettes at mc-stan.org/bayesplot
- bayesplot theme set to bayesplot::theme_default()
* Does _not_ affect other ggplot2 plots
* See ?bayesplot_theme_set for details on theme setting
>
> Sys.unsetenv("R_TESTS")
> test_check("bayesplot")
Note: in most cases the default test statistic 'mean' is too weak to detect anything of interest.
Note: in most cases the default test statistic 'mean' is too weak to detect anything of interest.
The 'independent' method is superseded by the 'correlated' method.
`stat_bin()` using `bins = 30`. Pick better value `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value `binwidth`.
`stat_bin()`
...[truncated]...
est-ppc-test-statistics.R:291:3',
'test-ppd-marginal.R:22:3', 'test-ppd-marginal.R:56:3'
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-ppc-loo.R:14:3'): (code run outside of `test_that()`) ──────────
Error in `vapply(x, FUN = match.arg(fun), FUN.VALUE = fun_val, item)`: values must be length 1500,
but FUN(X[[1]]) result is length 0
Backtrace:
▆
1. ├─base::suppressWarnings(psis1 <- psis(-log_lik(fit), cores = 2)) at test-ppc-loo.R:14:3
2. │ └─base::withCallingHandlers(...)
3. ├─loo::psis(-log_lik(fit), cores = 2)
4. └─loo:::psis.matrix(-log_lik(fit), cores = 2)
5. └─loo:::importance_sampling.matrix(...)
6. └─loo:::do_importance_sampling(...)
7. └─loo:::psis_apply(lw_list, "log_weights", fun_val = numeric(S))
8. └─base::vapply(x, FUN = match.arg(fun), FUN.VALUE = fun_val, item)
[ FAIL 1 | WARN 16 | SKIP 89 | PASS 1496 ]
Error:
! Test failures.
Execution halted- ERROR12 OK, 1 ERRORNow
- ERROR10 OK, 2 NOTE, 1 ERROR2026-08-26
- NOTE11 OK, 2 NOTE2026-07-16
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK12 OK2026-04-25
Show 1 earlier changeHide 1 earlier change
- NOTE11 OK, 3 NOTE2026-03-10
Documentation
- Help pages
- 36 (2 internal)includes a package overview page
- Examples that run
- 84%27 run in a plain check · 1 only when donttest examples are enabled (R CMD check --as-cran) · 4 never run
- Exported functions with examples
- 97%
- Documented parameters
- 72%
- Return-value docs
- 94%
- Help pages citing references
- 56%
Downloads
Repository
- PRs merged (all time)
- 89%
- Median days to close, 50 most recently updated closed issues
- 1
- Median days to close, 50 most recently updated closed PRs
- 2
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
11 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/stan-dev/bayesplot on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Funding links: GitHub Sponsors, mc-stan.org
The repository owner accepts GitHub Sponsors
GitHub Pages site last deployed 2026-10-13 · The repository has a site deploy workflow
pkgdown site last built 2026-08-25
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2025-12-30Pull request: opened by its own accountCommits: 1 by its own account · at least 1 crediting it in the message
Dependencies
Installing bayesplot adds 43 packages (24 with compiled code, 35 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, ggridges 2.1 MB.
Show the 48 most downloaded dependentsHide the 48 most downloaded dependents
and 6 more dependents and 56 packages that suggest it on CRAN ↗
Code & Tests
People & History
Show 5 more contributorsHide 5 contributors
Pick two releases to compare their code metrics.
- 1.16.0Latest2026-08-25 · current release · diff ↗ ·
added 10 exports
mcmc_dots, mcmc_dots_by_chain, ppc_calibration, ppc_calibration_data, ppc_calibration_grouped, ppc_calibration_overlay, ppc_calibration_overlay_grouped, ppc_loo_calibration, ppc_loo_calibration_grouped, ppc_rootogram_grouped - RR 4.6.0 released · 2026-04-24
- 1.15.02025-12-12 · diff ↗
- 1.14.0
- 1.13.0
- RR 4.5.0 released · 2025-04-11
- 1.12.02025-04-10 · diff ↗
- RR 4.4.0 released · 2024-04-24
- 1.11.12024-02-15 · diff ↗
- 1.11.02024-01-31 · diff ↗
- RR 4.3.0 released · 2023-04-21
- 1.10.0
- RR 4.2.0 released · 2022-04-22
- 1.9.02022-03-10 · diff ↗ ·
added 29 exports
available_ppd, ppc_bars_data, ppc_error_data, ppc_error_scatter_avg_grouped, ppc_km_overlay_grouped, ppc_scatter_avg_data, ppc_scatter_data, ppc_stat_data, ppc_stat_freqpoly, ppd_boxplot, ppd_data, ppd_dens, ppd_dens_overlay, ppd_ecdf_overlay, ppd_freqpoly, ppd_freqpoly_grouped, ppd_hist, ppd_intervals, ppd_intervals_data, ppd_intervals_grouped, ppd_ribbon, ppd_ribbon_data, ppd_ribbon_grouped, ppd_stat, ppd_stat_2d, ppd_stat_data, ppd_stat_freqpoly, ppd_stat_freqpoly_grouped, ppd_stat_grouped - 1.8.12021-06-14 · diff ↗
- RR 4.1.0 released · 2021-05-18
Show 16 earlier eventsHide 16 earlier events
- 1.8.02021-01-10 · diff ↗ ·
added 4 exports
ppc_dens_overlay_grouped, ppc_ecdf_overlay_grouped, ppc_km_overlay, ppc_loo_pit_data - 1.7.22020-05-28 · diff ↗
- RR 4.0.0 released · 2020-04-24
- 1.7.12019-12-02 · diff ↗
- 1.7.02019-05-23 · diff ↗ ·
added 6 exports
mcmc_rank_hist, mcmc_rank_overlay, mcmc_trace_data, param_glue, param_range, vars - RR 3.6.0 released · 2019-04-26
- 1.6.02018-08-02 · diff ↗ ·
added 4 exports
bayesplot_theme_get, bayesplot_theme_replace, bayesplot_theme_set, bayesplot_theme_update - RR 3.5.0 released · 2018-04-23
- 1.5.02018-03-30 · diff ↗ ·
added 9 exports
mcmc_areas_data, mcmc_areas_ridges, mcmc_areas_ridges_data, mcmc_dens_chains, mcmc_dens_chains_data, mcmc_intervals_data, ppc_data, ppc_loo_pit_overlay, ppc_loo_pit_qq - 1.4.02017-09-12 · diff ↗ ·
added 9 exports
mcmc_neff_data, mcmc_parcoord, mcmc_parcoord_data, mcmc_rhat_data, parcoord_style_np, ppc_intervals_data, ppc_ribbon_data, scatter_style_np, trace_style_np - 1.3.02017-08-07 · diff ↗
- RR 3.4.0 released · 2017-04-21
- 1.2.02017-04-12 · diff ↗ ·
added 14 exports
abline_01, mcmc_hex, mcmc_pairs, mcmc_recover_hist, mcmc_recover_scatter, overlay_function, pairs_condition, pairs_style_np, ppc_bars, ppc_bars_grouped, ppc_loo_intervals, ppc_loo_pit, ppc_loo_ribbon, ppc_rootogram - 1.1.0
- 1.0.02016-11-18
- RR 3.3.0 released · 2016-05-03
Package metadata
- First published
- 2016-11-18
- Total releases
- 21 / 10 yrs
- License
- GPL (>= 3) OSI
- Additional repositories
- stan-dev.r-universe.dev
- Minimum R
- ≥ 4.1.0
- Download size
- 5.0 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("bayesplot")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-20, which the citation names so these numbers can be found later. More on citing and the projects behind them.