The bayesplot MCMC module provides various plotting functions for creating graphical displays of Markov chain Monte Carlo (MCMC) simulations. The MCMC plotting functions section, below, provides links to the documentation for various categories of MCMC plots. Currently the MCMC plotting functions accept posterior draws provided in one of the following formats:

  • 3-D array: An array with dimensions [Iteration, Chain, Parameter] in that order.

  • list: A list of matrices, where each matrix corresponds to a Markov chain. All of the matrices should have the same number of iterations (rows) and parameters (columns), and parameters should have the same names and be in the same order.

  • matrix: A matrix with one column per parameter. If using matrix there should only be a single Markov chain or all chains should already be merged (stacked).

  • data frame: There are two types of data frames allowed. Either a data frame with one column per parameter (if only a single chain or all chains have already been merged), or a data frame with one column per parameter plus an additional column "Chain" that contains the chain number (an integer) corresponding to each row in the data frame.

Note: typically the user should not include warmup iterations in the object passed to bayesplot plotting functions, although for certain plots (e.g. trace plots) it can occasionally be useful to include the warmup iterations for diagnostic purposes.

MCMC plotting functions

Posterior distributions

Histograms and kernel density plots of parameter draws, optionally showing each Markov chain separately.

Uncertainty intervals

Uncertainty intervals computed from parameter draws.

Trace plots

Times series of parameter draws.


Scatterplots, heatmaps, and pairs plots of parameter draws.


Combination plots (e.g. trace plot + histogram).

General MCMC diagnostics

MCMC diagnostic plots including Rhat, effective sample size, autocorrelation.

NUTS diagnostics

Special diagnostic plots for the No-U-Turn Sampler.

Comparisons to "true" values

Plots comparing MCMC estimates to "true" parameter values (e.g., values used to simulate data).


Gabry, J., Simpson, D., Vehtari, A., Betancourt, M., and Gelman, A. (2018). Visualization in Bayesian workflow. Journal of the Royal Statistical Society Series A, accepted for publication. arXiv preprint:

See also

Other MCMC: MCMC-combos, MCMC-diagnostics, MCMC-distributions, MCMC-intervals, MCMC-nuts, MCMC-parcoord, MCMC-recover, MCMC-scatterplots, MCMC-traces