Metadata-Version: 2.4
Name: tidydraws
Version: 0.2.0
Project-URL: Homepage, https://github.com/drbenvincent/tidydraws
Project-URL: Repository, https://github.com/drbenvincent/tidydraws
Project-URL: Issues, https://github.com/drbenvincent/tidydraws/issues
Project-URL: Documentation, https://drbenvincent.github.io/tidydraws/
Author: Benjamin Vincent
License-Expression: MIT
License-File: LICENSE
Keywords: arviz,bayesian,dataframe,draws,mcmc,polars,tidybayes,visualisation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.12
Requires-Dist: arviz>=1.0
Requires-Dist: numpy
Requires-Dist: polars>=0.20
Requires-Dist: pyarrow>=24.0.0
Requires-Dist: xarray
Provides-Extra: all
Requires-Dist: lets-plot; extra == 'all'
Requires-Dist: plotnine; extra == 'all'
Requires-Dist: seaborn; extra == 'all'
Provides-Extra: dev
Requires-Dist: great-docs>=0.14.0; extra == 'dev'
Requires-Dist: ipykernel; extra == 'dev'
Requires-Dist: lets-plot; extra == 'dev'
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pandas-stubs; extra == 'dev'
Requires-Dist: plotnine; extra == 'dev'
Requires-Dist: prek; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: quarto>=0.1; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Provides-Extra: letsplot
Requires-Dist: lets-plot; extra == 'letsplot'
Provides-Extra: plotnine
Requires-Dist: plotnine; extra == 'plotnine'
Requires-Dist: seaborn; extra == 'plotnine'
Description-Content-Type: text/markdown

# tidydraws

![tidydraws logo](docs/assets/logo.jpg)

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

`tidydraws` turns MCMC output (ArviZ `DataTree`) 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()`](https://drbenvincent.github.io/tidydraws/docs/examples/parameter_draws.html) | parameter | density, forest, scatter |
| [`prediction_draws()`](https://drbenvincent.github.io/tidydraws/docs/examples/prediction_draws.html) | prediction | ribbon + line, fit + data |
| [`compare_draws()`](https://drbenvincent.github.io/tidydraws/docs/examples/compare_draws.html) | comparison | prior vs posterior, intervals |

![tidydraws example](docs/assets/index-plot.png)

## Install

With uv:
```bash
uv add tidydraws
```

With pip:
```bash
pip install tidydraws
```

## Why tidydraws?

Plotting MCMC output in Python means manually slicing xarray dimensions, iterating groups, and aligning coordinates — imperative, verbose, error-prone. R's [`tidybayes`](https://github.com/mjskay/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 `DataFrame`s. Call `.to_pandas()` to bridge to lets-plot, plotnine, or any library that takes pandas. See the [examples](https://drbenvincent.github.io/tidydraws/docs/examples/parameter_draws.html) for both lets-plot and plotnine versions.

---

*Inspired by [tidybayes](https://github.com/mjskay/tidybayes) for R.*
