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 with just 2 or 3 lines of code.

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

See examples.


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

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.8.tar.gz (3.7 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.8-py3-none-any.whl (126.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ninejs-0.0.8.tar.gz
  • Upload date:
  • Size: 3.7 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.8.tar.gz
Algorithm Hash digest
SHA256 f71920012473ce4d13da35288e5afd7292806aeed712772ec04f091babeaded7
MD5 0defb925f35a43cc646a4238ef512086
BLAKE2b-256 b6396b7b41e00ccab3753856c530679a1f9bc229221582145206cca66cb966d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ninejs-0.0.8.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.8-py3-none-any.whl.

File metadata

  • Download URL: ninejs-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 126.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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d9eb8bbe547eebb6854ec50885754dc10a757181a911624b111e3d2c8af10b77
MD5 92d21d8c659c424a06099817a397330f
BLAKE2b-256 05b9fd49c9fac1d0561175bdac1ea647a73703d01593b4ff3e44e07a1749563c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ninejs-0.0.8-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