Metadata-Version: 2.4
Name: eunoia
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Typing :: Typed
Requires-Dist: matplotlib>=3.8
Requires-Dist: numpy>=1.26
Requires-Dist: sphinx>=7 ; extra == 'docs'
Requires-Dist: furo ; extra == 'docs'
Requires-Dist: myst-nb ; extra == 'docs'
Requires-Dist: sphinx-copybutton ; extra == 'docs'
Requires-Dist: sphinx-autobuild ; extra == 'docs'
Provides-Extra: docs
License-File: LICENSE
Summary: Area-proportional Euler and Venn diagrams
Keywords: euler,venn,diagram,visualization,set
Author-email: Johan Larsson <johan@jolars.co>
License: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://jolars.github.io/eunoia-py
Project-URL: Issues, https://github.com/jolars/eunoia-py/issues
Project-URL: Repository, https://github.com/jolars/eunoia-py

# eunoia

Python bindings for the [eunoia](https://github.com/jolars/eunoia) Rust
library — area-proportional Euler and Venn diagrams. Sister package to the
R package [eulerr](https://github.com/jolars/eulerr).

> **Status:** v0.1.0 — initial release. The user-facing surface may evolve.

## Install

```bash
pip install eunoia
```

## Quickstart

```python
import eunoia as eu
import matplotlib.pyplot as plt

# Disjoint (per-region) input is the default.
fit = eu.euler({"A": 10, "B": 5, "A&B": 3})
print(fit)
# EulerFit (2 circles, diag_error=2.776e-17, stress=5.887e-33, loss=5.887e-33)
#                  original      fitted    residual regionError
#   A                    10          10           0           0
#   B                     5           5           0           0
#   A&B                   3           3   8.882e-16   2.776e-17

fit.plot()
plt.show()
```

### Inclusive input

If your numbers are set sizes that already include their overlaps, pass
`input="inclusive"` and the eunoia core handles the inclusion-exclusion
conversion:

```python
fit = eu.euler({"A": 13, "B": 8, "A&B": 3}, input="inclusive")
```

### Ellipses

Ellipses are more flexible than circles and fit many three-set arrangements
exactly:

```python
fit = eu.euler(
    {"A": 2, "B": 2, "C": 2, "A&B": 1, "A&C": 1, "B&C": 1},
    shape="ellipse",
)
print(fit.diag_error)  # ~1e-14
fit.plot(quantities=True)
```

### Plot styling

```python
fit.plot(
    colors=["#e41a1c", "#377eb8", "#4daf4a"],   # per-set
    quantities="fitted",                          # show fitted areas at region anchors
    labels=True,                                  # set names at set anchors
    edges={"linewidth": 1.5},
)
```

## Public API

| Function / class           | Purpose                                            |
| -------------------------- | -------------------------------------------------- |
| `eunoia.euler(values, …)`  | Fit a diagram from a `{combination: area}` dict   |
| `eunoia.EulerFit`          | Result class with shapes, fitted values, metrics  |
| `eunoia.Circle` / `Ellipse`| Per-set fitted shape                              |
| `eunoia.Point`             | 2D point                                          |
| `eunoia.EunoiaError`       | Base error type (subclass of `ValueError`)         |

## Status & roadmap (v0.1.0 → v0.2)

In v0.1.0:
- `dict` input only, with `input="exclusive"` / `"inclusive"`
- `circle` and `ellipse` shapes
- matplotlib-based plotting

Deferred to v0.2+:
- `venn()` (non-proportional, 1–5 sets)
- `error_plot()` diagnostic
- list-of-sets / DataFrame input
- `complement` (universe area outside all sets)
- `square` and `rectangle` shapes
- exposed optimizer / tolerance knobs

## License

[MIT](LICENSE)

