Yan Holtz logo ← All issues
Dataviz Universe

The new, best lib for interactive Python charts?

This week I shared a brand-new Python library called nineJs — and, to say the least, it got some echo. So today, let me explain what it's all about, and why so many people are excited about it.

Everything starts with plotnine

To understand nineJs, you first need to understand plotnine.

plotnine is a very popular Python package that lets you use the R ggplot2 syntax… in Python!

As you might know, ggplot2 is famous for its syntax. It's based on the grammar of graphics — a very natural, human-friendly way to think and write about building charts. plotnine lets you use exactly the same syntax, with the same sensible defaults, but in Python.

Code for a basic scatterplot with plotnine

It's a common problem to have to switch from R to Python at work. plotnine can make that transition seamless, at least on the dataviz side. But that's just the beginning of the story.

Introducing nineJs

nineJs pushes it one step further: it lets you add a few lines of code to make the graph interactive.

The idea is simple. You take a chart you already built with plotnine and you bring it to life — tooltips, hover effects that highlight groups of points, click events. And you declare all of it right inside aes(), exactly where you're already used to mapping your data.

nineJs interactive code

Two or three extra lines, and nineJs exports your chart as a standalone HTML file. No server, no heavy setup. It works out of the box with Jupyter, Quarto, Marimo and Shiny.

Why I love it

I love this approach, compared to other libraries that make interactive charts with Python, for three reasons:

1️⃣ No new syntax to learn. If you're familiar with ggplot2, it's very straightforward — just a bit of new code for the interactivity itself.

2️⃣ Consistent. If you already have a chart designed, you truly start from it. Switching to another lib would mean rebuilding everything from scratch; here, you just add the interactivity on top.

3️⃣ Flexible. It's based on the ggplot2 syntax, so you keep control over every customization. You won't get stuck fighting an inflexible API.

Demo

Take a look at the lib's demo page — it looks stunning! Here's a little GIF that gives you an overview.

nineJs demo

Bottom line

This lib was created by Joseph Barbier — it's already his 7th Python library, and every day I'm more impressed by the quality of his work. Joseph used to be my intern two years ago, and since then he hasn't stopped shipping awesome open-source tools for the community.

We also built an in-depth course about data visualization with Python together — the best way to benefit from his tech knowledge about Python and my knowledge about dataviz.

Make better Python charts


See you next week!
Yan

Enjoyed this?

Get one short, actionable dataviz tip every Saturday. Join 19,000+ data people.