pkgdocs/compare/d3 vs matplotlib

Comparing

npm

d3

The most powerful data visualization library for the web — bind data to SVG/Canvas elements and transform them with scales, axes, and layouts.

5.0M/ wk
v7.9.0
vs
Python

matplotlib

The go-to plotting library for Python — create static, animated, and interactive visualizations with a MATLAB-like API.

25.0M/ wk
v3.9.2
Metricd3matplotlib
EcosystemnpmPython
DifficultyAdvancedIntermediate ✓
Weekly downloads5.0M25.0M↑
Latest versionv7.9.0v3.9.2
Recipes13↑

Tags

d3 only

svganimation

Shared

visualizationchartsdata-science

matplotlib only

plottinggraphs

When to use each

d3

Custom visualizations that no library supports, journalism/scrollytelling data stories, network graphs, geo maps, animated transitions between data states, or when you need to own every detail.

matplotlib

Scientific plots, publication figures, embedding charts in reports, quick data exploration, custom visualizations that seaborn can't express, or when you need pixel-level control over a chart.

When to skip each

d3

Standard bar/line/pie charts in a product (use Recharts or Chart.js — they're 10x faster to implement). d3's learning curve is steep.

matplotlib

Interactive web dashboards (use Plotly or Bokeh), real-time streaming charts, or when you just want something beautiful fast (try seaborn first).

Sample recipes

d3

  • Build a bar chart from data

matplotlib

  • Plot a line chart
  • Create a multi-panel figure
  • Plot a heatmap / 2D matrix