Skip to main content

Bringing interactivity to plotnine

Project description

ninejs

Bringing ✨interactivity✨ to plotnine.

ninejs lets you add tooltips and hover grouping to plotnine plots directly from aes() via the tooltip and data_id aesthetic mappings, then export the result as a standalone HTML plot.

It works out of the box with Quarto, marimo, and Shiny, and it includes a built-in preview in Positron.


Quick start

from plotnine import aes, geom_point, ggplot, theme_minimal
from plotnine.data import anscombe_quartet

from ninejs import css, interactive, save

gg = (
  ggplot(
      anscombe_quartet,
      aes(x="x", y="y", color="dataset", tooltip="dataset", data_id="dataset")
  )
  + geom_point(size=7, alpha=0.5)
  + theme_minimal()
)

(
  interactive(gg)
  + css(from_dict={".tooltip": {"font-size": "2em"}})
  + save("plot.html")
)

Interactive scatterplot of Anscombe's quartet grouped by dataset with a visible tooltip


Installation

pip install ninejs

Integration

ninejs integrates with other tools out of the box.

  • Quarto

Quarto document rendering ninejs code above an Anscombe quartet scatterplot

  • Marimo

Marimo notebook rendering ninejs code above an Anscombe quartet scatterplot

  • Shiny

Shiny for Python app rendering a ninejs scatterplot with controls for dataset, point size, and opacity

  • Positron

Positron viewer showing a ninejs Anscombe quartet scatterplot next to the Python source code

  • Anywhere: ninejs outputs HTML files that only need a browser, so websites and web-based tools can embed them easily.

The next targets are:

  • Jupyter
  • Streamlit

Documentation

See the full documentation and examples here.

See the contributing guide for local setup, tests, and formatting.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ninejs-0.0.5.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ninejs-0.0.5-py3-none-any.whl (118.7 kB view details)

Uploaded Python 3

File details

Details for the file ninejs-0.0.5.tar.gz.

File metadata

  • Download URL: ninejs-0.0.5.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ninejs-0.0.5.tar.gz
Algorithm Hash digest
SHA256 82056158f6374ff9e0c6a80122617e3fb78471873e18ea7020aeca710d8e8656
MD5 c1a660a43b518ca2be24fabad80e27ee
BLAKE2b-256 45f66c0f34018cd9db2554f9f76716b0454852ff1e9adbc2f0cc4d5b89154aa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ninejs-0.0.5.tar.gz:

Publisher: pypi.yaml on y-sunflower/ninejs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ninejs-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: ninejs-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 118.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ninejs-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d524b379b3c21982d063ef636b9fec273b39d5e0b36bae3cc6a790241a57a4ec
MD5 12013bd7f3b51fbbdd8f23d701d495c2
BLAKE2b-256 c8c1d4a7a1180c27c5b3108669c5218519fc68e09f964f9e529a2e30df6cfa0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ninejs-0.0.5-py3-none-any.whl:

Publisher: pypi.yaml on y-sunflower/ninejs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page