15+ Plot Types
Trace plots, density plots, ACF, rank plots, pair plots, violin plots, forest plots, diagnostics heatmaps, and more — all powered by Plotly.js.
Parse, analyze, plot, and export MCMC sampling data. Works in browsers, Node.js, and from the command line. Zero runtime dependencies.
npm install mcmc-visualizerimport { fromChainArrays, plots } from 'mcmc-visualizer';
const data = fromChainArrays({
'chain#1': { mu: [1.2, 1.3, 1.1, 1.4], sigma: [0.5, 0.6, 0.5, 0.7] },
'chain#2': { mu: [1.0, 1.5, 1.2, 1.3], sigma: [0.4, 0.5, 0.6, 0.5] },
});
// Compute diagnostics
const stats = data.variableStats('mu');
console.log(stats.rhat, stats.bulkEss); // 1.001, 3847
// Render a trace plot into a DOM element
plots.tracePlot(document.getElementById('plot'), data, 'mu');
// Get a full summary table
const summary = data.summary();
// [{ variable: 'mu', mean: 1.25, rhat: 1.001, bulkEss: 3847, ... }]| Format | Read | Write |
|---|---|---|
| Turing.jl CSV (long) | yes | — |
| Turing.jl CSV (wide) | yes | — |
| Stan CSV | yes | — |
| MCMCChains.jl JSON | yes | — |
| ArviZ JSON | yes | — |
| Generic JSON | yes | yes |
| Raw arrays | yes | — |