Skip to main content

matplotly

PyPI version Python versions License Docs Open In Colab

Jupyter-native interactive matplotlib figure editor.

Edit any matplotlib figure interactively — styles, colors, labels, legends — then export reproducible Python code. No separate GUI; everything runs inline in your notebook.

Features

  • 10+ plot types: line, scatter, bar, histogram, box, violin, errorbar, heatmap, fill, marginal
  • AI style extraction: upload a reference plot image and automatically match its style (fonts, colors, spines, ticks, legend, etc.) using Claude or GPT vision models
  • Code generation: export a standalone Python script that recreates your styled figure
  • Undo / redo: full command history with keyboard shortcuts
  • Style profiles: save and load reusable figure styles
  • Subplot support: edit multi-panel figures with per-axes controls

Installation

pip install matplotly[ai]

This includes everything: the interactive editor plus AI-powered style extraction via Claude or GPT vision models. Requires an Anthropic or OpenAI API key for the AI features (set via environment variable or entered in the UI).

For a lightweight install without AI dependencies (anthropic, openai, Pillow, PyMuPDF):

pip install matplotly

The base install gives you the full interactive editor — manual controls for styles, colors, labels, legends, code export, undo/redo, and style profiles. The only difference is you won't have the AI style extraction tab.

Both versions require a Jupyter environment with the ipympl backend:

%matplotlib widget

Quick Start

%matplotlib widget
import matplotlib.pyplot as plt
from matplotly import matplotly

# 1. Pass a figure directly
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 9])
matplotly(fig)

# 2. Decorator mode
@matplotly
def my_plot():
    plt.plot([1, 2, 3], [1, 4, 9])

my_plot()

# 3. Context manager
with matplotly() as pb:
    fig, ax = plt.subplots()
    ax.plot([1, 2, 3], [1, 4, 9])

Supported Plot Types

Type Description
Line ax.plot()
Scatter ax.scatter()
Bar ax.bar() / ax.barh()
Histogram ax.hist()
Box ax.boxplot()
Violin ax.violinplot()
Errorbar ax.errorbar()
Heatmap ax.imshow() / ax.pcolormesh()
Fill ax.fill_between() / ax.fill_betweenx()
Marginal Joint + marginal distribution plots

AI Style Extraction

Have a plot style you want to match? Upload a reference image and let a vision model do the work.

How it works: You upload a reference plot image (PNG, JPEG, PDF, TIFF, or WebP) and select a vision model. The system runs a two-pass agentic pipeline:

  1. Pass 1 — Extraction: The vision model analyzes the reference image and extracts a structured JSON of style parameters: font sizes and families, spine visibility, tick direction/length, grid settings, legend placement, background color, and per-series properties (colors, line widths, markers, hatches, etc.).
  2. Pass 2 — Verification: The same model re-examines the reference image against the extracted parameters, checking each one for accuracy. Only fields that need correction are updated.

The corrected styles are then applied to your figure automatically — updating both the matplotlib artists and the UI controls so everything stays in sync.

Supported providers:

  • Anthropic: Claude Sonnet 4, Claude Haiku 3.5
  • OpenAI: GPT-5, GPT-4o, and variants

Saving and reusing styles: After extraction, you can download the result as a JSON profile. Load it later to apply the same style to any figure — no API call needed.

API keys: Set ANTHROPIC_API_KEY or OPENAI_API_KEY as an environment variable, or paste the key directly into the editor UI. No secrets are written to disk.

Documentation

Full documentation is available at matplotly.readthedocs.io.

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

MIT — see LICENSE for details.

Metadata

Release files for matplotly 0.1.5

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

Source distribution (sdist)

Source distribution for matplotly 0.1.5
File Size Uploaded
matplotly-0.1.5.tar.gz 2.1 MB Details

Built distribution (wheel)

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

Total release size: 2.2 MB

Release files / matplotly-0.1.5.tar.gz

Download URL matplotly-0.1.5.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
e0e6abea9f8e698d6651f3e567e64caf7e03680f402ef1ce146371287587f73d
BLAKE2b-256 checksum
How to use checksums
40e7fddbd68a16e6b265e4952c627e62f6bb0e7e27f655bac9fd3d4bbed33394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / matplotly-0.1.5-py3-none-any.whl

Download URL matplotly-0.1.5-py3-none-any.whl
Size 141.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7dd82e7778a7a312320d595e49ab10655c5892cbb5f830023933f82bb24737f
BLAKE2b-256 checksum
How to use checksums
486025e73dd3077923e22cadbc5425b198be5fc7563adb0ccc1cbcf07e3b3328
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

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