Bringing ✨interactivity✨ to plotnine.
ninejs adds interactive behavior to plotnine charts with a minimal API. You can attach tooltips, hover grouping, and on click events directly from aes(), then export the result as a standalone HTML plot. All of this with just 2 lines of code!
- Works out of the box with Jupyter, Quarto, Marimo, and Shiny
- Includes a built-in preview in Positron
- Supports adding custom CSS and JavaScript
- Copy-pastable self contained documentation for AI and agents
See examples.
from plotnine import aes, geom_point, ggplot, theme_minimal
from plotnine.data import anscombe_quartet
from ninejs import interactive, save
gg = (
ggplot(
anscombe_quartet,
aes(x="x", y="y", color="dataset", tooltip="dataset", hover_group="dataset")
)
+ geom_point(size=7, alpha=0.5)
+ theme_minimal()
)
interactive(gg) + save("plot.html")pip install ninejsSee the full documentation and examples here.
See the contributing guide for local setup, tests, and formatting.

