| name | scientific-plotting |
| description | Use when creating publication-quality matplotlib figures in Python — scientific line plots, scatter, error bars, heatmaps, contour, bar, histogram, 3D, multi-panel, log-scale, twin/inset axes, and colorbars. Applies APS journal styling (Helvetica, 8pt, inward ticks, brewer_set1 palette) with mathtext fallback when LaTeX isn't installed. Saves figures as 300 DPI PNG. Customization guidance for Nature, Science, IEEE column widths and fonts. |
Scientific Plotting (pubplot-style)
Generate publication-quality matplotlib figures using APS-derived styling.
Inspired by pubplot but self-contained:
no pubplot package required.
When this applies
Use when the user:
- Asks to plot data for a paper, thesis, or journal submission
- Says "publication quality", "make this plot look professional", or names a journal (APS, Nature, Science, IEEE, ACS)
- Builds matplotlib figures and asks for consistent styling across multiple plots
Skip for:
- Plotly, seaborn-only, bokeh, or dashboard work
- General matplotlib debugging unrelated to styling
- Data analysis without producing a figure
Quick start
-
Copy the bundled module into the user's project root
The file scripts/pubplot_style.py (in this skill directory) is a drop-in
module. Copy it to wherever the user's plotting scripts live:
cp <skill>/scripts/pubplot_style.py ./pubplot_style.py
-
In every plotting script, import and apply the style up front
import matplotlib.pyplot as plt
import numpy as np
from pubplot_style import apply_style, linestyle_generator
apply_style()
-
Build the plot using a recipe from references/recipes.md
-
Save as 300 DPI PNG
fig.savefig("figure.png", dpi=300, bbox_inches="tight")
Decision tree
| User wants | Read |
|---|
| Single line or multiple curves to distinguish | references/recipes.md § Line / Multi-curve |
| Scatter / error bars / shaded bands | references/recipes.md § Scatter, Errorbar |
| Heatmap or 2D field | references/recipes.md § Heatmap; references/colors.md for colormap choice |
| Bar, histogram, violin, box | references/recipes.md § Bar / Hist / Violin |
| Contour or 3D | references/recipes.md § Contour / 3D |
| Multi-panel figure with subplot labels | references/recipes.md § Multi-panel |
| Log-scale axes, twin axes, inset axes | references/recipes.md § Log-scale, Twin/Inset |
| Match Nature / Science / IEEE / ACS sizing | references/customization.md |
| Switch LaTeX ↔ mathtext, or LaTeX errors | references/customization.md § LaTeX, then troubleshooting.md |
| Any rendering error | references/troubleshooting.md |
What apply_style() does
- Font: Helvetica (fallback Arial / DejaVu Sans), 8pt base
- Figure size: 3.375" × 2.295" (single column, APS default)
- Inward ticks on all four sides, minor ticks visible
- Frameless legend, compact spacing
- Default color cycle:
BREWER_SET1 (8 colors + black)
- LaTeX rendering on by default with siunitx + Helvetica preamble
- Save defaults: 300 DPI PNG,
bbox_inches="tight"
Pass latex=False for mathtext rendering when LaTeX is unavailable. Pass
columns=2 for double-column figures.
Loading order for references
Don't pre-load all reference files. Load them as needed:
references/recipes.md — when picking a plot type
references/colors.md — when choosing a colormap beyond the default cycler
references/customization.md — when targeting a non-APS journal, switching LaTeX↔mathtext, or tweaking figure sizes
references/troubleshooting.md — only when a specific error appears
Boundary
This skill provides styling and recipes. It does NOT:
- Choose what data to plot
- Decide what story the figure tells
- Run statistical analysis
- Manage figure version control