Eunoia

Python bindings for the Eunoia Rust library for area-proportional Euler and Venn diagrams. Sister package to the R package eulerr.

An Euler diagram lays out one shape per set and sizes and positions them so that every region’s area is proportional to the quantity it represents. Eunoia fits that layout with a fast Rust optimizer and draws it with matplotlib:

import eunoia as eu

fit = eu.euler(
    {"A": 10, "B": 7, "C": 8, "A&B": 3, "A&C": 4, "B&C": 2, "A&B&C": 1}
)
fit.plot(quantities=True);
_images/f82ac87a41e2743e2fc5b1f0551e2d23c64b4b9c1337d4c78d2051a2f41fbe82.png

Why Eunoia

  • Area-proportional. Region areas track your numbers, so the picture is quantitative, not just topological.

  • Several shapes. Fit with circles, ellipses, squares, or rectangles. Ellipses handle relationships that circles cannot draw exactly.

  • Flexible input. Pass per-region areas, inclusive set sizes, membership lists, a pandas/polars DataFrame, or a numpy boolean array read as a membership matrix.

  • Venn diagrams too. venn() draws topological Venn diagrams for one to five sets.

  • Matplotlib native. Plots are ordinary Axes, so they slot into figures, subplots, and your usual styling.

  • Fast and typed. The optimizer is Rust; the API is fully type-annotated and ships a py.typed marker.

Install

pip install eunoia

Wheels are published for Linux, macOS, and Windows; no Rust toolchain is needed to install.

At a glance

The fit object holds the requested and fitted values and can plot itself:

fit = eu.euler({"A": 10, "B": 5, "A&B": 3})
print(fit)
fit.plot();
EulerFit (2 circles, diag_error=1.11e-16, stress=7.359e-33, loss=2.502e-32)
         original      fitted    residual regionError
  A            10          10   1.776e-15    1.11e-16
  B             5           5           0           0
  A&B           3           3   4.441e-16   2.776e-17
_images/829d8f0e3099fc72a563bb228d3eba9b870ac83979472b66f275d93b2deab585.png

Swap in ellipses (or "square", "rectangle") for arrangements circles cannot capture, and label regions with their fitted values:

fit = eu.euler(
    {"A": 2, "B": 2, "C": 2, "A&B": 1, "A&C": 1, "B&C": 1},
    shape="ellipse",
)
fit.plot(quantities="fitted");
_images/799c22c6b45cd14c3357c301ecebcc49adaefe889f79d282daa2115b46269a6a.png

Next steps

Citation

If you use Eunoia for Python in your research, please cite the paper:

Larsson, J., & Lee, N. M. (2026). Eunoia: Area-Proportional Euler and Venn Diagrams in Rust, Julia, Python, R, and JavaScript (arXiv:2611.02198). arXiv. https://doi.org/10.48550/arXiv.2611.02198

@misc{larsson2026f,
  title         = {Eunoia: {{Area}}-Proportional {{Euler}} and {{Venn}} Diagrams in {{Rust}}, {{Julia}}, {{Python}}, {{R}}, and {{JavaScript}}},
  shorttitle    = {Eunoia},
  author        = {Larsson, Johan and Lee, Nicole M.},
  year          = {2026},
  month         = nov,
  number        = {arXiv:2611.02198},
  eprint        = {2611.02198},
  primaryclass  = {stat.CO},
  publisher     = {arXiv},
  doi           = {10.48550/arXiv.2611.02198},
  archiveprefix = {arXiv}
}
BibLaTeX
@online{larsson2026f,
  title       = {Eunoia: {{Area}}-Proportional {{Euler}} and {{Venn}} Diagrams in {{Rust}}, {{Julia}}, {{Python}}, {{R}}, and {{JavaScript}}},
  shorttitle  = {Eunoia},
  author      = {Larsson, Johan and Lee, Nicole M.},
  date        = {2026-11-01},
  eprint      = {2611.02198},
  eprinttype  = {arXiv},
  eprintclass = {stat.CO},
  doi         = {10.48550/arXiv.2611.02198},
  pubstate    = {prepublished}
}

For reproducibility, also cite the software release you used. Select that release in the Zenodo archive and export its citation. The concept DOI 10.5281/zenodo.20650005 identifies Eunoia for Python across all releases.

CITATION.cff contains the software metadata and preferred paper citation. The Eunoia citation page renders the paper in APA, BibTeX, BibLaTeX, and other formats.