Quickstart: Python
eunoia is the Python binding. You hand euler() a dict of set sizes, it fits an area-proportional diagram, and .plot() renders it with matplotlib.
Install
pip install eunoia Wheels ship for all common platforms, so no Rust toolchain is needed. Plotting uses matplotlib (a dependency).
Fit a diagram
import eunoia as eu
import matplotlib.pyplot as plt
fit = eu.euler({"A": 5, "B": 3, "A&B": 1.5})
print(fit) # residual table + goodness-of-fit metrics
fit.plot()
plt.show() The input dict is keyed by combination expression: a single set ("A") or
sets joined with & ("A&B"). Values are exclusive by default: the part of A outside B is 5, the overlap is 1.5. Pass input="inclusive" if your
numbers are full set sizes and the core will decompose them:
fit = eu.euler({"A": 8, "B": 4.5, "A&B": 1.5}, input="inclusive") The result carries the fitted geometry and fit statistics:
fit.shapes # list of fitted Circle/Ellipse structs
fit.loss # objective value (lower is better)
fit.diag_error # largest single-region error Pick a different shape
fit = eu.euler({"A": 5, "B": 3, "A&B": 1.5}, shape="ellipse")
fit.plot(quantities=True) shape is one of "circle" (default), "ellipse", "square", or "rectangle". Ellipses are more flexible and often fit three or more sets
noticeably better; see Shapes.
Customize the plot
fit.plot(
colors=["#e41a1c", "#377eb8"], # per-set
quantities="fitted", # show fitted areas at region anchors
labels=True,
edges={"linewidth": 1.5},
) eunoia.options(...) sets defaults for every subsequent plot; reset_options() reverts to the built-ins.
Venn diagrams
For a fixed, non-proportional Venn template (every intersection shown
regardless of size), use venn(); it accepts a set count, a list of names, or a
mapping:
fit = eu.venn(["A", "B", "C"])
fit.plot(quantities=True) Ellipse Venn diagrams support 1–5 sets; circle, square, and rectangle support 1–3.
Next steps
The full API reference lives on the eunoia-py docs site. For how the fit works across all bindings, see the Fitter pipeline and Goodness of fit chapters.