Comparison with other Python packages

Python packages for set-membership diagrams differ in what they represent and how they fit layouts. This page compares their approaches and benchmarks the packages that, like eunoia, fit area-proportional Euler diagrams.

The landscape

“Draw a Venn diagram” can mean several different things. Some packages fit area-proportional diagrams, others use fixed layouts, and others compute set sizes without drawing a diagram. The area-proportional fitters are directly comparable to eunoia.

Package

Area-proportional

Max sets

Shapes

Method

License

eunoia

yes

arbitrary

circle, ellipse, square, rectangle

numerical optimization (Rust core); reports residuals and goodness of fit

MIT

matplotlib-set-diagrams

yes

arbitrary

circles

optimization-based layout

GPL-3

matplotlib-venn

yes

3

circles

closed-form (2 sets); cost-based layout (3 sets)

MIT

BioVenn

yes

3

circles

area-proportional, with biological ID mapping

MIT

vennplot

yes

3

circles or balls (2D and 3D)

area-proportional

MIT

supervenn

yes (exact)

many

bars or chunks

splits sets into parts; not an Euler diagram

MIT

pyvenn/venn

no

6

fixed templates

static shapes; only labels move

MIT

matplotlib-subsets

no

—

nested rectangles

set hierarchy, not an Euler layout

MIT

eule

n/a

arbitrary

none

set algebra only; computes region sizes, draws nothing

MIT

The packages fall into four groups:

  • Area-proportional fitters: matplotlib-set-diagrams, matplotlib-venn, BioVenn, and vennplot solve the same problem as eunoia. We benchmark the first two below. BioVenn and vennplot are capped at three circles, so they add little to the comparison beyond matplotlib-venn.

  • Alternative representations: supervenn is exactly proportional but represents sets as strips of bars or chunks. These are not Euler diagrams, so the same geometric metric does not apply.

  • Diagrams without proportional areas: pyvenn/venn and matplotlib-subsets use fixed templates or nested rectangles. Their diagrams do not encode set sizes through area.

  • Set algebra: eule computes disjoint region sizes from membership without drawing a diagram. Its output can serve as input to a fitter. eunoia performs the same preprocessing internally when you pass it membership lists (eu.euler({"A": [...], "B": [...]})), a pandas or Polars DataFrame, or a NumPy boolean array used as a membership matrix.

Benchmark

Across the benchmark cases, eunoia’s circles achieve lower error than the other circle fitters within each shared objective. Its ellipses achieve the lowest error. The figures below compare fit accuracy and fit time, followed by representative layouts.

Accuracy, grouped by objective

Each figure compares fitters configured to minimize the same loss. Lower scores indicate a closer fit. The methodology explains the scoring, and the detailed results give the scores for every case.

Squared error

Under the squared loss, eunoia’s circles reach a lower stress than matplotlib-set-diagrams on every case, often by an order of magnitude on the harder specifications. eunoia’s ellipses reach essentially zero error.

Horizontal grouped dot chart of stress by case for fitters minimizing squared error.

Scale-invariant squared error (stress, log scale; lower is better). eunoia uses loss="sum_squared", and matplotlib-set-diagrams uses "squared".

Absolute error

The same advantage appears under the absolute loss: eunoia’s circles achieve lower error than matplotlib-set-diagrams on every case. Its ellipses have the lowest error by a wide margin.

Horizontal grouped dot chart of absolute error by case for fitters minimizing absolute error.

Scale-invariant absolute error (log scale; lower is better). eunoia uses loss="sum_absolute", and matplotlib-set-diagrams uses "simple".

Logarithmic error

This group matches matplotlib-venn’s default objective. eunoia’s circles achieve lower error than both matplotlib-venn and matplotlib-set-diagrams on every case, while its ellipses achieve the lowest error by a wide margin. The two competitors produce similar scores. matplotlib-venn supports at most three sets, so it has no dots for the larger cases.

Horizontal grouped dot chart of logarithmic error by case, with matplotlib-venn limited to three sets.

Scale-invariant logarithmic error (log scale; lower is better). eunoia uses loss="log_sum_absolute", matplotlib-set-diagrams uses "logarithmic", and matplotlib-venn uses its default objective. Missing dots mark unsupported set counts.

The core added "log_sum_absolute" in version 1.1 (closing jolars/eunoia#96), allowing eunoia to take part in this group. The choice of loss lets users match the objective to their data.

Wall-clock fit time

The benchmark also measures end-to-end fit time using one representative configuration per package, matching the gallery below. matplotlib-venn is fastest but supports at most three sets. eunoia and matplotlib-set-diagrams have broadly comparable fit times, both taking up to a few seconds on the hardest specifications with many sets.

eunoia’s non-smooth losses, "sum_absolute" and "log_sum_absolute", are markedly slower to optimize than the smooth "sum_squared" default shown here.

Horizontal grouped dot chart of median fit time per case, log scale.

Median fit time per case (log scale; lower is faster). Each package uses the same configuration as in the gallery. Missing dots mark unsupported set counts.

Fitted layouts

The layouts below show how fit errors affect the diagrams. eunoia’s ellipses preserve the target areas where the circle layouts visibly distort them. Each column shows one fitter, and each row shows one benchmark case.

Grid of fitted layouts, one column per fitter, one row per case.

Fitted layouts for representative corpus cases, with eunoia using its default squared loss and matplotlib-set-diagrams using "squared". Shaded panels mark set counts that matplotlib-venn does not support.

How the comparison works

Area-proportional fitters do not all minimize the same loss. Scoring a fitter on a loss it was not configured to minimize would make the comparison unfair. The packages use the following objectives, where \(f_i\) and \(t_i\) are the fitted and target areas of region \(i\):

Package and config

Minimizes

matplotlib-venn venn2

closed-form exact

matplotlib-venn venn3 (default)

\(\sum_i \lvert\log(1+f_i) - \log(1+t_i)\rvert\) (logarithmic \(L_1\))

matplotlib-set-diagrams

a selectable cost: "squared" (\(\sum_i (f_i - t_i)^2\)), "simple" (\(\sum_i \lvert f_i - t_i\rvert\)), "logarithmic", "relative", "inverse"

eunoia

a selectable loss=: "sum_squared", "sum_absolute", "log_sum_absolute", "stress", "diag_error", …

The only fair comparison is within an objective: choose a loss family, configure each package that supports it to minimize that loss, and score them on the same loss. eunoia and matplotlib-set-diagrams are configurable, so they appear in several groups. matplotlib-venn has a fixed objective, so it appears only in the logarithmic group, which matches its venn3 default.

Each group is scored on a scale-invariant version of its loss. The score accounts for a single multiplicative scale factor on the fitted areas because each package draws its diagram at an arbitrary size. For the squared-error family, this score is exactly the stress used by venneuler and eulerr. The absolute and logarithmic families use the analogous scale-invariant \(L_1\) and logarithmic \(L_1\) scores.

Of these packages, only eunoia reports a goodness-of-fit measure itself. The benchmark harness measures every fitter in the same way by rasterizing the returned shapes. It also checks that eunoia’s rasterized stress matches the value eunoia computes analytically. The two agree to the resolution of the grid.

The benchmark specifications are a curated subset of the eunoia Rust corpus, which was ported from eulerr’s reproducibility tests and real datasets from the eulerr issue tracker. They span 2 to 6 sets and include layouts that circles provably cannot fit exactly, as well as real biology and kinase data. The full harness is in benchmarks/.

Detailed results

Expand the tables below to inspect the accuracy scores and fit times for every benchmark case.

View accuracy results

Sum of squared errors

Objective: minimize \(\sum_i (f_i - t_i)^2\); scored on stress (lower is better).

Case

Sets

eunoia (circle)

eunoia (ellipse)

matplotlib-set-diagrams

two_overlap

2

0.0000

0.0000

0.0082

three_set_small_overlaps

3

0.0002

0.0000

0.0002

uniform_3_set

3

0.0087

0.0000

0.1477

eulerape_3_set

3

0.0004

0.0000

0.0007

issue47_3_set_huge_triple

3

0.0245

0.0000

0.0281

issue111_3_set_asymmetric

3

0.0000

0.0000

0.0000

issue114_4_set_dominant_quad

4

0.0135

0.0000

0.1223

issue103_4_set

4

0.0041

0.0000

0.0097

issue93_5_set_kinases

5

0.0112

0.0000

0.0952

wilkinson_6_set

6

0.0042

0.0000

0.1012

Sum of absolute errors

Objective: minimize \(\sum_i \left|f_i - t_i\right|\); scored on abs_error (lower is better).

Case

Sets

eunoia (circle)

eunoia (ellipse)

matplotlib-set-diagrams

two_overlap

2

0.0001

0.0001

0.0022

three_set_small_overlaps

3

0.0073

0.0048

0.0121

uniform_3_set

3

0.0650

0.0004

0.0862

eulerape_3_set

3

0.0116

0.0080

0.0289

issue47_3_set_huge_triple

3

0.0806

0.0044

0.1621

issue111_3_set_asymmetric

3

0.0003

0.0002

0.0024

issue114_4_set_dominant_quad

4

0.0961

0.0511

0.2477

issue103_4_set

4

0.0801

0.0541

0.1123

issue93_5_set_kinases

5

0.0979

0.0900

0.4890

wilkinson_6_set

6

0.0412

0.0364

0.3656

Logarithmic error

Objective: minimize \(\sum_i \left|\log(1+f_i) - \log(1+t_i)\right|\); scored on log_error (lower is better).

Case

Sets

eunoia (circle)

eunoia (ellipse)

matplotlib-venn

matplotlib-set-diagrams

two_overlap

2

0.0020

0.0020

0.0020

0.0021

three_set_small_overlaps

3

0.0163

0.0016

0.0197

0.0193

uniform_3_set

3

0.0644

0.0015

0.0653

0.0652

eulerape_3_set

3

0.0852

0.0024

0.1449

0.1078

issue47_3_set_huge_triple

3

0.1161

0.0109

0.1449

0.1452

issue111_3_set_asymmetric

3

0.0046

0.0004

0.0060

0.0057

issue114_4_set_dominant_quad

4

0.1544

0.0569

—

0.1679

issue103_4_set

4

0.1607

0.0577

—

0.2154

issue93_5_set_kinases

5

0.2214

0.1881

—

0.6291

wilkinson_6_set

6

0.0349

0.0241

—

0.3224

View timing results

Median end-to-end fit wall-clock time in milliseconds (median of 5 runs; lower is faster). Indicative only — timings are machine- and load-dependent.

Case

Sets

eunoia (circle)

eunoia (ellipse)

matplotlib-venn

matplotlib-set-diagrams

two_overlap

2

11

14

7

340

three_set_small_overlaps

3

18

30

11

614

uniform_3_set

3

534

28

10

575

eulerape_3_set

3

23

75

11

197

issue47_3_set_huge_triple

3

486

40

11

726

issue111_3_set_asymmetric

3

44

54

11

714

issue114_4_set_dominant_quad

4

1107

197

—

29

issue103_4_set

4

917

1132

—

651

issue93_5_set_kinases

5

1312

3823

—

3056

wilkinson_6_set

6

2234

231

—

9742

Reproducing

See the benchmark README for setup instructions and commands to reproduce the results.

Note

The numbers and figures on this page are committed to the repository and updated by running the benchmark. The documentation build itself does not install or execute the competitor packages.