Skip to content

tvhahn/matplotlib-skill

Repository files navigation

matplotlib -- Claude Code Skill

Publication-quality matplotlib/seaborn charts from a one-line prompt. Colorblind-accessible, despined, annotation-rich figures using DejaVu Sans, cubehelix/ColorBrewer palettes, and whitegrid styling. Opinionated.

Usage

> make a chart of collision rates by state using the matplotlib skill

The skill picks the chart type, applies opinionated templates and palettes, and saves PDF+PNG to ./figures/.

Before vs. After

Same data. Same prompt. The skill applies despined axes, cubehelix palettes, value labels, and insight annotations.

Claude defaults With skill
More comparisons
Claude defaults With skill

Install

Clone (auto-discovered by Claude Code)

git clone https://github.com/tvhahn/matplotlib-skill.git
cd matplotlib-skill
# Claude Code auto-discovers skills/matplotlib/SKILL.md when working in this repo

Global install (available in all projects)

ln -s /path/to/matplotlib-skill/skills/matplotlib ~/.claude/skills/matplotlib

Per-session (no symlink needed)

claude --add-dir /path/to/matplotlib-skill

Plugin install

/plugin marketplace add tvhahn/matplotlib-skill
/plugin install matplotlib

9 Chart Patterns


P1 Horizontal Bar

P2 Vertical Bar

P3 Time Series

P4 Violin + Strip

P5 Lollipop

P6 Decision Boundary

P7 Heatmap

P8 Multi-Panel

P9 PR/ROC
Pattern When to use
P1 Horizontal Bar Ranked percentages, category comparisons
P2 Vertical Bar Comparisons across categories, ranked values
P3 Time Series Time series with rolling average
P4 Violin + Strip Distribution comparisons
P5 Lollipop Min/max/avg ranges, model comparison
P6 Decision Boundary Classification boundaries, probability maps
P7 Heatmap Correlation matrices, spectrograms
P8 Multi-Panel Multi-panel grid layouts (2x2, 3x2, 3x3)
P9 PR/ROC PR/ROC classification evaluation curves

Design Philosophy

Above all else, show the data. Annotate the insight, not just the axis. When in doubt, remove.

Full principles
  1. Above all else, show the data
  2. Every element earns its ink
  3. Prefer position over color, color over size
  4. Grey is a color. White space is a feature.
  5. Despine, degrid, then add back only what the reader needs
  6. Annotate the insight, not just the axis
  7. Encode meaning twice -- never rely on color alone
  8. Consistency across panels; variety across charts
  9. The reader should never do arithmetic
  10. When in doubt, remove

How This Skill Was Built

Built through 50 iterations of automated evaluation -- an AI refining its own visual taste. Read the story on my blog →

Datasets

Ships with 39 datasets for testing and demos:

  • 10 source project datasets from Tim's research (bearing RUL predictions, arxiv paper labels, classifier comparisons, tool wear)
  • 29 public reference datasets (penguins, gapminder, tips, iris, titanic, and more)

See data/datasets.yaml for the full manifest with attribution, licenses, and pattern mappings.

Verification

# Generate charts in a Docker clean room (Docker required)
scripts/chart-test-container.sh --quick            # 5 prompts, random from pools
scripts/chart-test-container.sh                    # all 9 prompts, random from pools
scripts/chart-test-container.sh --fixed            # all 9 prompts, original defaults

# Static analysis (fast, no Docker)
uv run scripts/evaluate_skill.py --check-renders

Contributing

Contributions are welcome — whether it's improving an existing pattern or adding an entirely new chart type. Some ideas to get started:

  • Improve a pattern: Refine annotations, spacing, or palette choices in any of the 9 existing patterns
  • Add a new chart type: Scatter plot, grouped bar chart, and fill_between area chart are all on the wishlist — or propose your own
  • Add datasets: New public datasets that pair well with existing or new patterns

See CONTRIBUTING.md for guidelines on modifying patterns, adding new ones, and running tests.

License

MIT

About

Claude Code skill for publication-quality matplotlib/seaborn charts

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages