Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 3.28 KB

File metadata and controls

64 lines (41 loc) · 3.28 KB

PyPI Version License: MIT Python

CI Ruff pre-commit

GitHub Stars Downloads PyPI Downloads

tidydraws

A tidybayes-inspired data layer for declarative Bayesian visualisation in Python

tidydraws turns MCMC output (ArviZ) into tidy Polars frames that are ready to plot — one .to_pandas() away from any ggplot-like backend. It does no plotting itself. Three functions, three spaces:

Function Space Plot archetype
parameter_draws() parameter density, forest, scatter
prediction_draws() prediction ribbon + line, fit + data
compare_draws() comparison prior vs posterior, intervals

tidydraws example

Install

With uv:

uv add tidydraws

With pip:

pip install tidydraws

If you want the latest functionality merged into main but not yet released, install directly from GitHub:

pip install git+https://github.com/drbenvincent/tidydraws.git

Or with uv:

uv add git+https://github.com/drbenvincent/tidydraws.git

Why tidydraws?

Plotting MCMC output in Python means manually slicing xarray dimensions, iterating groups, and aligning coordinates — imperative, verbose, error-prone. R's tidybayes solved this with a data layer that respects parameter space vs prediction space. tidydraws brings that to Python on Polars.

Backend-agnostic: tidydraws returns Polars DataFrames. Call .to_pandas() to bridge to lets-plot, plotnine, or any library that takes pandas. See the examples for both lets-plot and plotnine versions.


Inspired by tidybayes for R.