Skip to main content

Area-proportional Euler and Venn diagrams

Project description

Eunoia

CI PyPI version

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

Euler circles, ellipses, and a Venn diagram fitted with Eunoia

Install

pip install eunoia

Quickstart

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:

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:

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

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},
)

Venn diagrams

venn() draws a topological (not area-proportional) diagram in which every intersection is shown, regardless of its size. It accepts a set count, a list of names, or a {combination: area} 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.

Other shapes

Besides "circle" (default) and "ellipse", euler() and venn() accept shape="square" and shape="rectangle".

Global plotting options

eunoia.options(...) sets defaults for every subsequent plot (colors, edges, labels, quantities, legend, complement). Called with no arguments it returns a snapshot; called with category kwargs it returns a context manager that restores the previous state on exit. reset_options() reverts to the built-ins.

Public API

Function/class Purpose
eunoia.euler(values, …) Fit an area-proportional diagram from a dict
eunoia.venn(sets, …) Fit a topological Venn diagram
eunoia.EulerFit/VennFit Result classes with shapes, fitted values, metrics
eunoia.Circle/Ellipse Per-set fitted shape (circle / ellipse)
eunoia.Square/Rectangle Per-set fitted shape (square / rectangle)
eunoia.Container Universe box drawn behind a complement= diagram
eunoia.Point 2D point
eunoia.options/get_options/reset_options Global plotting defaults
eunoia.EunoiaError Base error type (subclass of ValueError)

Ecosystem

This package is the Python member of the Eunoia family. The same Rust core powers bindings in several languages:

Project Language Distribution
eunoia Rust (core) crates.io
@jolars/eunoia JavaScript/TS (WASM) npm
eunoia (this package) Python PyPI
eulerr R (original) CRAN

Narrative documentation for the whole family lives at eunoia.bz/docs/; the Rust API reference is at docs.rs/eunoia.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eunoia-0.3.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

eunoia-0.3.0-cp311-abi3-win_amd64.whl (854.8 kB view details)

Uploaded CPython 3.11+Windows x86-64

eunoia-0.3.0-cp311-abi3-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

eunoia-0.3.0-cp311-abi3-musllinux_1_2_aarch64.whl (949.6 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

eunoia-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl (883.1 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

eunoia-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl (771.6 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

eunoia-0.3.0-cp311-abi3-macosx_11_0_arm64.whl (759.4 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

eunoia-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl (854.7 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file eunoia-0.3.0.tar.gz.

File metadata

  • Download URL: eunoia-0.3.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eunoia-0.3.0.tar.gz
Algorithm Hash digest
SHA256 121f32cd220dd3952f6cc813c8dbe8cada8f5b551e851fe95e60d2b012772620
MD5 af92ebff47b0b50344dcd8493882761c
BLAKE2b-256 a2b197fba8056d1aa2fd49a471f1c6e8b9ca8b461a9aa7f611938a28dfcced9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0.tar.gz:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eunoia-0.3.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: eunoia-0.3.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 854.8 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eunoia-0.3.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b8bdcbc023311e4a831a1054ab96ea454ae10c322ceb0778c78142b1b0f952f8
MD5 ace851e6e17d4c49bfed2b4ad5b159f3
BLAKE2b-256 183089d8ef79d80cc36a9a14d1d12b1e566aee0f0ef8a730061113f6917facc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0-cp311-abi3-win_amd64.whl:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eunoia-0.3.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for eunoia-0.3.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ac8490b066d8958f02125105d549c9840169e5e45ff8b2171a86c0c710bb6bb9
MD5 856fed206ebf72d272b0648f85f3b12c
BLAKE2b-256 6d33493c2ffabd12660f1b94d593c311b8a2013d03f0c19222fc369c1319e36e

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0-cp311-abi3-musllinux_1_2_x86_64.whl:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eunoia-0.3.0-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for eunoia-0.3.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a8f10f492336a208a1f0d894e56b3e3e8aa1d18628be3b04def4c6cf9705b5fc
MD5 961cc1dfa144185005467660a6f99870
BLAKE2b-256 9bb641983edbc9c76b3fe92ef13a4c5a078898d5bd41e4c11a39ed49afd42977

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0-cp311-abi3-musllinux_1_2_aarch64.whl:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eunoia-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for eunoia-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b617a154475142cf7aed06daf44f188ee3b04013977fdc9468c85166c91db0cf
MD5 d55b292ebbfabe6879de5064a7e4cfc3
BLAKE2b-256 3698c3db4d5a0895c759ed5a3a5e4c5e1997c8807c6966d6aa1290e71bb46bdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eunoia-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for eunoia-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 89d89a6e2ed49e02209d73949f07d7ff9c7a900f8c72f9d90bd2f23aaac23153
MD5 20fb24508644493ab8ea09a95f87bcd0
BLAKE2b-256 c69aceec8dd8fe1ff0d139f7332157671a64eea1347f5d41299723e7ca6cb251

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eunoia-0.3.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eunoia-0.3.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1227f222e7b5795dd3a2ae05721b2d2440de05bb3341275a18b20de5950a63db
MD5 f76d14abdffaac4a5a6be8359fbe877a
BLAKE2b-256 e2d81485771565532ad151071a67faa55b82ec30acd87937215cedf229860e2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eunoia-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for eunoia-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ee52256c8a0e0c85b3b8ff4b70062cda1d0fa498b282bc974264a905b6a9cbd9
MD5 9a2417ba29afbab63f5aad1c7e3ceb79
BLAKE2b-256 045a1e04e6df22124bb40cf4576defdc832e1098f873dd44e97fdbe1922e32a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: publish.yml on jolars/eunoia-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page