mpld3
D3 Viewer for Matplotlib
What it is and what it does
mpld3 bridges matplotlib and the web by converting static plots into interactive D3.js visualizations. It parses matplotlib figures using the mplexporter framework, outputs them as JSON, and renders them in a browser with pan, zoom, and hover interactivity. The package is pure Python and lightweight, making it straightforward to add to existing matplotlib workflows.
Typical use is embedding interactive plots in IPython notebooks or generating standalone HTML files for sharing. Many core matplotlib features are supported, though some advanced features like tick formatting, certain legend options, and twin axes remain unsupported. The package is in beta status and aging—the original author is no longer actively maintaining it, though the repository accepts pull requests.
Use it for:
- Embed interactive matplotlib plots in IPython notebooks for exploratory data analysis.
- Export static matplotlib figures as standalone HTML files for sharing with non-technical stakeholders.
- Add pan, zoom, and hover tooltips to scientific plots without rewriting visualization code.
- Create web-based dashboards combining matplotlib plots with D3.js interactivity.
- Prototype interactive visualizations quickly from existing matplotlib code before building custom D3 solutions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts matplotlib plots to interactive D3.js visualizations in the browser, enabling exploration and interaction with static graphics through a web-based viewer.
Yes, if you need quick interactivity on matplotlib plots and can tolerate aging maintenance. The package is stable, has no known vulnerabilities, and installs with low friction. However, verify compatibility with your Python and matplotlib versions first—classifiers suggest old version support, and the maintainer has limited availability for bug fixes. Best suited for exploratory work or prototyping rather than production systems requiring active support.
Install
mpld3 on PyPI
pip
pip install mpld3uv
uv add mpld3poetry
poetry add mpld3Installing mpld3
Before you install
Low install friction with pure-Python distribution. Maintenance is aging—the lead maintainer states limited availability, though pull requests are reviewed. Last release was 282 days ago; repository remains active with 2413 stars.
License in practice
BSD 3-clause is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
import matplotlib.pyplot as plt
import mpld3
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3])
html = mpld3.fig_to_html(fig)
# Open html in browser or embed in IPython notebook
Requires matplotlib 2.2.2 and jinja2 2.7+; classifiers list Python 2.6–2.7 and 3.3–3.4, though requires_python is unspecified.
Verify before relying
- Whether the package actually works with modern Python versions (3.8+) despite classifiers listing only 2.6–3.4.
- Current compatibility with recent matplotlib versions beyond the stated 2.2.2 requirement.
- Whether IPython notebook integration remains functional with current Jupyter versions.
Package facts
| License | BSD 3-clause (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — jinja2, matplotlib |
| Maintenance | aging — 282 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 580,157/month — #5,914 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mpld3-0.5.12-py3-none-any.whl
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
mplcursorsAdds interactive point-selection cursors to…
unclear · top 5,000 on PyPI
python-nvd3Generates interactive NVD3 charts (pie, line,…
permissive · top 5,000 on PyPI
py3DmolEmbeds an interactive 3D molecular viewer in…
permissive · top 15,000 on PyPI
mplfinancemplfinance provides matplotlib-based…
permissive · top 15,000 on PyPI
matplotlibmatplotlib creates static, animated, and…
permissive · top 1,000 on PyPI
ipymplipympl enables interactive matplotlib plots in…
permissive · top 5,000 on PyPI
pyLDAvispyLDAvis creates interactive web-based…
permissive · top 15,000 on PyPI
splotsplot creates static and interactive…
permissive · top 15,000 on PyPI
bqplotbqplot is a 2-D interactive plotting library…
permissive · top 15,000 on PyPI