This skill should be used when the user asks to "create a plot", "make a chart", "visualize data", "create a heatmap", "make a scatter plot", "plot time series", "create publication figures", "customize plot styling", "use matplotlib", "use seaborn", or needs guidance on Python data visualization, statistical graphics, or figure export.
View on GitHubskills/python-dataviz/SKILL.md
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/tbhb/oaps/blob/main/skills/python-dataviz/SKILL.md -a claude-code --skill python-datavizInstallation paths:
.claude/skills/python-dataviz/# Python Data Visualization
Python data visualization with matplotlib and seaborn for creating publication-quality figures, statistical graphics, and exploratory visualizations.
## When to use each library
**Matplotlib** is the foundational plotting library. Use it for:
- Fine-grained control over every plot element
- Custom layouts with GridSpec or subplot_mosaic
- 3D visualizations
- Animations
- Embedding plots in GUI applications
- When you need low-level customization
**Seaborn** builds on matplotlib for statistical visualization. Use it for:
- Statistical plots with automatic aggregation and confidence intervals
- Dataset-oriented plotting from DataFrames
- Faceted multi-panel figures (small multiples)
- Distribution visualization (KDE, histograms, violin plots)
- Correlation matrices and clustered heatmaps
- Publication-ready aesthetics with minimal code
**Combined approach**: Use seaborn for the main visualization, then customize with matplotlib.
## Core concepts
### Matplotlib hierarchy
1. **Figure** - Top-level container for all plot elements
2. **Axes** - Actual plotting area (one Figure can have multiple Axes)
3. **Artist** - Everything visible (lines, text, ticks, patches)
4. **Axis** - The x/y number lines with ticks and labels
### Two matplotlib interfaces
**Object-oriented interface (recommended)**:
```python
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(10, 6))
ax.plot(x, y, linewidth=2, label='data')
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.legend()
plt.savefig('figure.png', dpi=300, bbox_inches='tight')
```
**pyplot interface** (quick exploration only):
```python
plt.plot(x, y)
plt.xlabel('X Label')
plt.show()
```
Always use the object-oriented interface for production code.
### Seaborn function levels
**Axes-level functions** plot to a single matplotlib Axes:
- Accept `ax=` parameter for placement
- Return Axes object
- Examples: `scatterplot`, `histplot`, `boxplot`, `heatmap`
**Figure-level func