matplotlib-venn
Functions for plotting area-proportional two- and three-way Venn diagrams in matplotlib.
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-vennuv
uv add matplotlib-vennpoetry
poetry add matplotlib-vennInstalling 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
Tags
More Visualization packages
matplotlib creates static, animated, and…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
plotlyPlotly is an interactive, browser-based…
permissive · top 1,000 on PyPI
graphvizGenerates DOT language source code for graph…
permissive · top 1,000 on PyPI
streamlitStreamlit transforms Python scripts into…
permissive · top 1,000 on PyPI
leatherLeather is a lightweight Python charting…
permissive · top 1,000 on PyPI
UpSetPlotUpSetPlot generates visualizations of set…
permissive · top 15,000 on PyPI
descartesConverts geometric objects and GeoJSON-like…
permissive · top 15,000 on PyPI
koreanize-matplotlibAutomatically configures matplotlib to display…
permissive · top 15,000 on PyPI
plotbinPlotBin provides utilities to create and…
unclear · top 15,000 on PyPI
pygraphvizPyGraphviz provides a Python interface to…
permissive · top 5,000 on PyPI
diagramsDiagrams lets you draw cloud system…
permissive · top 5,000 on PyPI
lovelyplotsLovelyPlots provides matplotlib style sheets…
permissive · top 15,000 on PyPI
torchvizGenerates visual diagrams of PyTorch neural…
permissive · top 5,000 on PyPI
cmeel-qhullProvides precompiled qhull binaries (convex…
unclear · top 15,000 on PyPI
textual-plotextWraps the Plotext plotting library as a Textual…
permissive · top 15,000 on PyPI