Skip to main content

plotjs: Turn static matplotlib charts into interactive web visualizations

plotjs logo

plotjs is a Python package that transform matplotlib plots into interactive charts with minimum user inputs. It's very easy to use and highly extensible! It lets you:

  • control tooltip labels and grouping
  • add CSS
  • add JavaScript
  • and many more

[!IMPORTANT] Consider that the project is still unstable.

Online demo



Installation

From PyPI (recommended):

pip install plotjs

Latest dev version:

pip install git+https://github.com/y-sunflower/plotjs.git

Quickstart

plotjs mainly provides a PlotJS class

import matplotlib.pyplot as plt
from plotjs import PlotJS, data

df = data.load_iris()

fig, ax = plt.subplots()
ax.scatter(
    df["sepal_length"],
    df["sepal_width"],
    c=df["species"].astype("category").cat.codes,
    s=180,
    alpha=0.6,
    ec="black",
)

(
    PlotJS(fig)
    .add_tooltip(labels=df["species"])
    .save("iris-scatter.html")
)

Open iris-scatter.html in your browser to get hover tooltips and default highlight/fade behavior.


Why plotjs?

plotjs keeps your existing matplotlib workflow and adds interactivity on top of the SVG that matplotlib already knows how to generate. Instead of rebuilding the chart in another library, you keep the same Figure, export it to HTML, and control the browser-side behavior with CSS and JavaScript.

Learn more in the Q&A.


Features Overview

  • Keep your existing matplotlib figure and export it as a standalone interactive HTML file
  • Add hover tooltips from any iterable of labels
  • Highlight related elements together with groups=...
  • Restrict interactivity to specific element types with on=...
  • Use direct hover or nearest-element hover with hover_nearest=True
  • Add custom CSS with strings, dictionaries, or files
  • Add custom JavaScript with strings or files, and optionally load D3.js
  • Work with multiple matplotlib axes in the same figure
  • Export either to disk with save() or to an HTML string with as_html()

Documentation


Contribution

Looking to contribute? Check out the contributing guide. You can get an overview of how the project works here, and in the AGENTS.md file.

Metadata

Release files for plotjs 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plotjs 0.0.12
File Size Uploaded
plotjs-0.0.12.tar.gz 1.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for plotjs 0.0.12
File Interpreter ABI Platform
plotjs-0.0.12-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / plotjs-0.0.12.tar.gz

Download URL plotjs-0.0.12.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
98c54c8b1d1597deeded3d6f2c1e52ab3e4cdb2eb74b1627ad905566fcceb7c5
BLAKE2b-256 checksum
How to use checksums
56538fe52ad9f7daa88ff89ed019aac55f7105ff2bd3714d5f723f612deee309
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release files / plotjs-0.0.12-py3-none-any.whl

Download URL plotjs-0.0.12-py3-none-any.whl
Size 42.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10bacee9fe196eff5112f82485ea1ad8117883d1b0f034ace9b0a49ac080b5ab
BLAKE2b-256 checksum
How to use checksums
fe7214731320a7d7d962e212a53e0c6423f49b5ba6ff12765b2a67de1f3244e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page