# seaborn

> Statistical visualization with pandas integration — use for quick exploration of distributions, relationships, and categorical comparisons with attractive defaults including box plots, violin plots, pair plots, and heatmaps built on matplotlib.

**Use case**: Quick statistical plots with attractive defaults from pandas

**Canonical URL**: https://agentcookbooks.com/skills/seaborn/

**Topics**: claude-code, skills, science, data-science

**Trigger phrases**: "plot this data with seaborn", "violin plot", "pair plot", "seaborn heatmap", "distribution plot"

**Source**: [K-Dense AI](https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/seaborn)

**License**: MIT

---

## What it does

`seaborn` is a Claude Code skill from K-Dense AI's [scientific-agent-skills repo](https://github.com/K-Dense-AI/scientific-agent-skills). It turns Claude into a seaborn expert for statistical visualization directly from pandas DataFrames — covering distribution plots (histplot, kdeplot, ecdfplot), categorical plots (boxplot, violinplot, stripplot, swarmplot), relational plots (scatterplot, lineplot), matrix plots (heatmap, clustermap), and the figure-level interfaces (FacetGrid, PairGrid).

A session produces clean, legible Python code that goes from a DataFrame to a publication-worthy exploratory figure with appropriate statistical annotations and sensible aesthetic defaults.

## When to use it

Reach for it when:

- You want to explore distributions, relationships, or group differences in tabular data quickly
- You're generating figures for papers or reports where seaborn's built-in statistical aggregation (confidence intervals, regression lines) saves you from writing the aggregation code yourself
- You need pair plots or faceted grids to compare multiple variables simultaneously

When *not* to reach for it:

- Fine-grained custom styling at the Artist level — use `matplotlib` directly
- Publication-quality multi-panel figures with journal-specific requirements — use `scientific-visualization`
- Interactive web plots — consider plotly

## Install

Copy the `SKILL.md` from K-Dense AI's [seaborn folder](https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/seaborn) into `.claude/skills/seaborn/` in your project.

Trigger phrases: "plot this data with seaborn", "violin plot", "pair plot", "seaborn heatmap".

## What a session looks like

A typical session has three phases:

1. **Data and plot specification.** Describe your DataFrame structure and the comparison or distribution you want to visualize. Claude identifies the most appropriate seaborn plot type and figure-level interface.
2. **Code generation.** Claude writes seaborn code with explicit theme setting (`sns.set_theme()`), palette selection, and axes-level plot calls that can be embedded in a matplotlib figure for multi-panel composition.
3. **Statistical annotation.** If comparisons between groups are needed, Claude adds significance annotations using `statannotations` or manual matplotlib annotation on top of the seaborn base plot.

## Receipts

**Where it works well:**
- Pair plots for exploratory analysis of multi-variable datasets — seaborn's PairGrid handles the faceting and diagonal plots reliably with a single function call
- Violin + strip plot combinations for showing both distribution shape and individual data points — a common pattern in biology that seaborn makes straightforward

**Where it backfires:**
- Very large datasets where seaborn's row-by-row rendering becomes slow — for datasets over ~100k points, switch to hex bins or use datashader
- Complex multi-panel layouts where panels need to share axes or have different plot types — the matplotlib subplot interface is cleaner for these

**Pattern that works:** use seaborn for the exploratory phase to understand your data, then port the best plots to `scientific-visualization` for the final publication figure with journal-specific styling applied.

## Source and attribution

Originally authored by [K-Dense Inc.](https://github.com/K-Dense-AI). The canonical SKILL.md lives in the [`seaborn` folder](https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/seaborn) of their public scientific-agent-skills repository.

License: MIT. Install, adapt, and redistribute with attribution preserved.

This page documents the skill from a practitioner's perspective. For the formal spec and any updates, defer to the source repo.