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.4.0.tar.gz (1.1 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.4.0-cp311-abi3-win_amd64.whl (863.4 kB view details)

Uploaded CPython 3.11+Windows x86-64

eunoia-0.4.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.4.0-cp311-abi3-musllinux_1_2_aarch64.whl (957.8 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

eunoia-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl (895.5 kB view details)

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

eunoia-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl (781.2 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

eunoia-0.4.0-cp311-abi3-macosx_11_0_arm64.whl (766.4 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

eunoia-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl (867.2 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for eunoia-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5a7ec11ed9086dbf13d17a14132bb8e11ff92c5eb039987282a055ce266d455c
MD5 27af12fc20774b3f4a7261379c2fa267
BLAKE2b-256 a479ab533430b74ddaf40f4f024dd2678f1a6e932140f3511aa7ae0f37900731

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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.4.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: eunoia-0.4.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 863.4 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.4.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 817f4dc3377e3a60da2afd836c1c5829d1114a37d9fff5d3621ec49d87ecfdb5
MD5 4d07d834799062709e3038b2a592047a
BLAKE2b-256 fe52f740694ff86575e65d1e11d5246753ba3ea2e5b75cb4f076febafcd92028

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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.4.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for eunoia-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5f75e68d75ab362275b85dbb2ac291d70f21044fa0f6cc0c675a2fba7d056309
MD5 52276c9041d5676ee1f5f55373f7f40f
BLAKE2b-256 2cff6fa3eb999365b0c7838f0f71a1ff115d62c94675b1841b8babee97ed07de

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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.4.0-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for eunoia-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7b86e978fc221c5ed927d09192aaaaa68bb198b09ae2a0b72290ae13b63e046c
MD5 e4205a66866ed4a9065d76f8b341256c
BLAKE2b-256 affa1c53c9df11faff5509bc53cc0a14382ec9f5a42d65276ceeb104eb405400

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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.4.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for eunoia-0.4.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 74a39ee90c2124ae2f5756448949b31ca08c54d4a65e660906dfa5f4681f2a49
MD5 5387a040cd4fadd760dbc4cd58bdfb80
BLAKE2b-256 32c18c6b9653839ec29a7653035c98d28976a7b95547dacf35aea6c8eb9f8d94

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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.4.0-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for eunoia-0.4.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 12dd7e25b0cfb08d77c2efa3e2069a385d8299e7602d02cde5fe19c9ce22c49a
MD5 4b8688504d89a657575580dd5963509c
BLAKE2b-256 68aa6ec8a1e839dbeee5bb41537fd783cf52fc3e96dc2df88c74f62cdcb4682a

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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.4.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eunoia-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4d25ce30c982abe71932d6b4d970d73f96fadb753caf90e229c63ceacbf9d70
MD5 c791440d4326a96d899d8724845e806c
BLAKE2b-256 2ff18d04a62e5be224f116f44b54cf4fdbfc14d54aeb369216fdb2e559353d73

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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.4.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for eunoia-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9b9dd17aa072ebec4a4b51f936fdb5450774b1899a3370b86bf6fc50a25d4cb3
MD5 a191e6028db30f54a9da2ceb5e93621e
BLAKE2b-256 84f5fef61200bf28dbb07850f0fd4ff2a71797cce04cc5af685769b2bee7cd7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for eunoia-0.4.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