Metadata-Version: 2.4
Name: ninejs
Version: 0.1.1
Summary: Bringing interactivity to plotnine
Author-email: Joseph Barbier <joseph@ysunflower.com>
License-Expression: MIT
Project-URL: Documentation, https://y-sunflower.github.io/ninejs/
Project-URL: Homepage, https://y-sunflower.github.io/ninejs/
Project-URL: Issues, https://github.com/y-sunflower/ninejs/issues
Project-URL: Repository, https://github.com/y-sunflower/ninejs
Keywords: D3,browser,interactivity,matplotlib,plotnine,visualization,web
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Matplotlib
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jinja2>=3.0.0
Requires-Dist: matplotlib>=3.10.0
Requires-Dist: narwhals>=2.0.0
Requires-Dist: plotnine>=0.12.0
Dynamic: license-file

<img src="https://github.com/JosephBARBIERDARNAL/static/blob/main/python-libs/ninejs/image.png?raw=true" alt="ninejs logo" align="right" width="150px"/>

<div style="font-size: 1.6em">

# ninejs

![Coverage](./coverage-badge.svg)
![Python Versions](https://img.shields.io/badge/Python-3.10–3.14-blue)

</div>

Bringing ✨***interactivity***✨ to [plotnine](https://plotnine.org/).

`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](https://y-sunflower.github.io/ninejs/guide/jupyter), [Quarto](https://y-sunflower.github.io/ninejs/guide/quarto), [Marimo](https://y-sunflower.github.io/ninejs/guide/marimo), and [Shiny](https://y-sunflower.github.io/ninejs/guide/shiny)
- Includes a built-in [preview in Positron](https://y-sunflower.github.io/ninejs/guide/positron)
- Supports adding custom [CSS](https://y-sunflower.github.io/ninejs/guide/css) and [JavaScript](https://y-sunflower.github.io/ninejs/guide/javascript)
- Copy-pastable [self contained documentation](https://y-sunflower.github.io/ninejs/#tools-for-ai-and-agents) for AI and agents

See [examples](https://y-sunflower.github.io/ninejs/).

<br>

## Quick start

```python
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")
```

![Interactive scatterplot of Anscombe's quartet grouped by dataset with a visible tooltip](./quick-start.png)

<br>

## Installation

```bash
pip install ninejs
```

<br>

## Documentation

See the full documentation and examples [here](https://y-sunflower.github.io/ninejs/).

See [the contributing guide](docs/contributing.md) for local setup, tests, and formatting.
