skillfed

matplotlib-venn

Functions for plotting area-proportional two- and three-way Venn diagrams in matplotlib.

matplotlib-venn v1.1.2 285.8K downloads/30d#8,053 on PyPI578
Permissive license MIT Active released

What it is and what it does

matplotlib-venn provides four main functions—venn2, venn2_circles, venn3, and venn3_circles—that render two- and three-circle Venn diagrams with region areas proportional to subset sizes. You pass either a tuple of subset counts or a tuple of set objects, and the package draws colored patches with text labels showing the overlaps. The functions return objects that expose the underlying Matplotlib patches and text elements for further customization.

The package includes two layout algorithms: a default pairwise algorithm that balances the representation of individual set sizes and pairwise intersections, and an optional cost-based algorithm (requiring Shapely) that optimizes circle placement against a user-provided cost function. The description notes that exact area correspondence is not always achievable for three-circle diagrams, and provides tuning options via fixed_subset_sizes and alternative layout algorithms.

Use it for:

  • Visualize overlaps between two or three datasets (e.g., genes in different experiments, users across platforms)
  • Compare membership of sets in scientific or statistical analysis to show intersection sizes at a glance
  • Generate publication-ready Venn diagrams with customizable colors, labels, and styling via Matplotlib
  • Explore set relationships interactively by tuning layout algorithms and cost functions for better visual clarity
  • Embed Venn diagrams in multi-panel figures or dashboards using Matplotlib's subplot and axes API

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Plots area-weighted two- and three-circle Venn diagrams using Matplotlib, with optional support for cost-based layout optimization via Shapely.

Yes, if you already have Matplotlib, NumPy, and SciPy in your environment and need to visualize two- or three-way set overlaps. The package is actively maintained, has no known vulnerabilities, and is widely used (top 15000 on PyPI). High install friction is a minor concern only if you lack the core scientific stack; the MIT license poses no restrictions.

Install

matplotlib-venn on PyPI

pip

pip install matplotlib-venn

uv

uv add matplotlib-venn

poetry

poetry add matplotlib-venn

Installing matplotlib-venn

Before you install

High install friction: the package itself has no runtime dependencies, but Matplotlib, NumPy, and SciPy must be present in your environment. The optional Shapely dependency unlocks an alternative layout algorithm for three-circle diagrams; the description notes Shapely may become required in future versions.

License in practice

MIT license is permissive—you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install matplotlib-venn

from matplotlib_venn import venn2
venn2(subsets=(3, 2, 1))

# Or with sets:
from matplotlib_venn import venn3
venn3([set(['A', 'B', 'C']), set(['B', 'C', 'D']), set(['C', 'D', 'E'])])

Requires Matplotlib, NumPy, and SciPy to be installed. Cost-based layout for venn3 requires optional Shapely dependency.

Verify before relying

  • Whether the package works with modern Python versions (requires_python is unspecified in metadata)
  • Performance characteristics when handling large subset sizes or complex diagrams

Package facts

License MIT (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance actively maintained — 535 days since the last release
Last repo commit
First released
Downloads 285,813/month — #8,053 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: matplotlib-venn-1.1.2.tar.gz

Keywords: matplotlib, plotting, charts, venn-diagrams

Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Visualization

Tags

venn diagram plottingarea-weighted venn diagramsmatplotlib venn circlesset intersection visualizationtwo-way three-way vennvenn diagram layoutset overlap diagrams
set-visualizationmatplotlib-extension

More Visualization packages