gitwtfhub

wtf is pyd3?

rougier/pyd3 — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2016-01-02

11PythonAudience · dataComplexity · 2/5DormantSetup · easy

TL;DR

A Python port of D3.js's scale, color, and interpolation tools for mapping data values into visual properties like position and color.

Mindmap

mindmap
  root((repo))
    What it does
      Maps data to visuals
      Interpolates values
      Handles color spaces
    Tech stack
      Python
    Use cases
      Custom data plots
      Interactive dashboards
      Automated chart generation
    Audience
      Data scientists
      Developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Map a data range like 10-130 onto pixel positions or chart coordinates automatically

REASON 2

Create smooth color gradients between two colors for heatmaps or charts

REASON 3

Automate chart generation in Python without manually computing bar positions or shades

What's in the stack?

Python

How it stacks up

rougier/pyd32arons/llm-cliadzza/guardium-dns
Stars111111
LanguagePythonPythonPython
Last pushed2016-01-02
MaintenanceDormant
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedatadevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Work in progress, not all D3 modules have been ported yet.

Wtf does this do

pyd3 is a Python version of parts of D3, a popular JavaScript library for creating interactive visualizations. Instead of building charts in JavaScript, this project lets you use similar tools in Python, mainly for transforming and mapping data into visual properties like colors, positions, and sizes. The core idea is simpler than it sounds. Imagine you have data ranging from 10 to 130, and you want to position items on a screen from 0 to 960 pixels. A scale does that translation automatically. Feed it 10 and it returns 0, feed it 130 and it returns 960, feed it 70 and it returns somewhere in between. The library also handles color mapping, you can say "I want a gradient from brown to steelblue" and it smoothly blends between them. The interpolate module is the engine behind this: it knows how to smoothly transition between any two values, whether they're numbers, colors, or even nested dictionaries with mixed content inside. The project includes three main toolsets. The color module handles different color spaces (RGB, HSL, Lab, and others) so you can work with colors in whatever way makes sense for your work. The interpolate module does the blending, given a start and end point, it creates a function that returns intermediate values as you move from 0 to 1. The scale module combines these ideas to map abstract numbers or categories into visual encodings, which is essential for any chart or data visualization. This would be useful for anyone building data visualizations in Python, data scientists making custom plots, developers building interactive dashboards, or anyone automating chart generation. Rather than manually computing where each bar should go or what shade a heatmap cell should be, you define your data's range and your visual range, and the library handles the math. The README notes this is a work in progress, so not all D3 modules have been ported over yet.

Yoink these prompts

Prompt 1
Show me how to use pyd3's scale module to map my dataset's values onto a 0-960 pixel range.
Prompt 2
Explain how the interpolate module in pyd3 blends between two colors or numbers.
Prompt 3
Help me build a custom heatmap in Python using pyd3's color and scale tools instead of matplotlib defaults.

Frequently asked questions

wtf is pyd3?

A Python port of D3.js's scale, color, and interpolation tools for mapping data values into visual properties like position and color.

What language is pyd3 written in?

Mainly Python. The stack also includes Python.

Is pyd3 actively maintained?

Dormant — no commits in 2+ years (last push 2016-01-02).

How hard is pyd3 to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is pyd3 for?

Mainly data.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.