Applies publication-ready matplotlib styling for empirical finance and economics figures. Covers colorblind-safe palettes, serif fonts, PDF export settings, and common figure types (time series, decile bars, coefficient plots, event studies).
Ships in ai-asset-pricing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
For this repo, the production plotting toolkit is fintools.figures. Read
docs/ai/figures.md first, then choose the plotting path deliberately:
fintools.figures helpers for repo work, Word proof packs,
validation checks, and dataframe-to-figure suites.style="fins" for the house publication style and style="ft" for
FT-style output.finance.mplstyle / figutils.py assets only
when the user explicitly wants the older standalone helper style or needs a
portable snippet outside the package workflow.To recreate the FT validation gallery:
python tools/figure_examples.py --style ft --docx --output results/figures
To recreate the house-style gallery:
python tools/figure_examples.py --style fins --docx --output results/figures
Generated PNG/PDF/DOCX/caption files belong under ignored results/figures/
paths. Do not commit maintainer proof packs or local gallery outputs.
Apply these conventions whenever creating figures. The goal: every figure Claude produces is publication-ready by default — no manual cleanup needed.
Prefer fintools.figures for this repo. The helper assets below remain
available for standalone or explicitly requested legacy publication-style
plots.
Copy finance.mplstyle from this skill directory into the project, then:
import matplotlib.pyplot as plt
plt.style.use('path/to/finance.mplstyle')
Or apply inline (no file needed):
import matplotlib.pyplot as plt
plt.rcParams.update({
'font.family': 'serif',
'font.serif': ['Times New Roman', 'STIXGeneral', 'DejaVu Serif'],
'mathtext.fontset': 'stix',
'font.size': 9,
'axes.labelsize': 9,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'legend.fontsize': 8,
'axes.linewidth': 0.6,
'axes.spines.top': False,
'axes.spines.right': False,
'lines.linewidth': 1.2,
'xtick.direction': 'out',
'ytick.direction': 'out',
'legend.frameon': False,
'figure.dpi': 150,
'savefig.dpi': 600,
'savefig.format': 'pdf',
'pdf.fonttype': 42,
})
Default cycle (Okabe-Ito, colorblind-safe):
PALETTE = ['#377EB8', '#E41A1C', '#4DAF4A', '#984EA3',
'#FF7F00', '#A65628', '#F781BF', '#999999']
Two-series (long vs short, treatment vs control):
BLUE_RED = ['#377EB8', '#E41A1C']
Grayscale-safe (for guaranteed print clarity):
GRAYSCALE = ['#000000', '#555555', '#999999', '#CCCCCC']
# Combine with linestyles: '-', '--', ':', '-.'
Sequential/diverging colormaps: Use viridis or cividis (colorblind-safe) for heatmaps. Use RdBu_r for diverging (correlation matrices).
| Context | Width (inches) | Use |
|---|---|---|
| Single column | 3.5 | Most journal figures |
| 1.5 column | 5.25 | Medium panels |
| Double column / full width | 7.0 | Wide multi-panel figures |
| Slide / presentation | 10.0 | Beamer, PowerPoint |
Aspect ratio: Default to golden ratio (width / 1.618). Use square for heatmaps, wide (width / 2.0) for time series.
def set_size(width='single', ratio='golden'):
widths = {'single': 3.5, 'onehalf': 5.25, 'double': 7.0, 'slide': 10.0}
ratios = {'golden': 1.618, 'square': 1.0, 'wide': 2.0}
w = widths.get(width, width)
r = ratios.get(ratio, ratio)
return (w, w / r)
fig, ax = plt.subplots(figsize=set_size('double', 'wide'))
ax.plot(dates, values)
ax.set_xlabel(''); ax.set_ylabel('Return (%)')
ax.axhline(0, color='grey', linewidth=0.5, zorder=0) for zero referenceax.axvspan(start, end, alpha=0.1, color='grey')cumret = (1 + returns).cumprod()
ax.plot(cumret.index, cumret.values)
ax.set_ylabel('Growth of $1')
ax.set_yscale('log')# returns_df: DataFrame with columns 0..9 (portfolio return time series)
plot_portfolio_bars(ax, returns_df, show_ls=True, ls_label='10-1')
# Computes means, Newey-West SEs (lag = floor(T^0.25)), 95% CI error bars
# Includes long-short bar with t-stat annotation
plot_portfolio_bars for any portfolio sort figure — it handles NW SEs automaticallyFor simple bars without CIs (pre-computed means):
plot_decile_bars(ax, means, highlight_extremes=True, spread_label=True)
ax.errorbar(coefs, range(len(coefs)), xerr=[coefs-ci_lo, ci_hi-coefs],
fmt='o', color='#377EB8', capsize=3, markersize=4)
ax.axvline(0, color='grey', linewidth=0.5, linestyle='--')
ax.set_yticks(range(len(names))); ax.set_yticklabels(names)
days = range(event_window[0], event_window[1] + 1)
ax.plot(days, car, color='#377EB8')
ax.fill_between(days, ci_lo, ci_hi, alpha=0.2, color='#377EB8')
ax.axvline(0, color='grey', linewidth=0.5, linestyle='--')
ax.axhline(0, color='grey', linewidth=0.5)
ax.set_xlabel('Days Relative to Event'); ax.set_ylabel('CAR (%)')
import seaborn as sns
mask = np.triu(np.ones_like(corr, dtype=bool), k=1)
sns.heatmap(corr, mask=mask, cmap='RdBu_r', center=0, vmin=-1, vmax=1,
annot=True, fmt='.2f', linewidths=0.5, ax=ax,
cbar_kws={'shrink': 0.8})
fig, axes = plt.subplots(1, 3, figsize=set_size('double', 'wide'))
# Label panels
for i, ax in enumerate(axes):
ax.text(-0.1, 1.05, f'({chr(97+i)})', transform=ax.transAxes,
fontsize=10, fontweight='bold', va='top')
Before saving any figure:
pdf.fonttype = 42 (already in style)bbox_inches='tight' to avoid clipped labelsfig.savefig('figure.pdf', bbox_inches='tight', dpi=600)
# Also save PNG for quick preview:
fig.savefig('figure.png', bbox_inches='tight', dpi=150)
| Journal | Override |
|---|---|
| RFS | Export as TIF at 300 DPI (photos) or 600 DPI (line art). Fonts: Arial, Courier, Times, Helvetica, Symbol only. |
| AER | No shading, no gridlines, no background color. Vector PDF/EPS preferred. Max 9 columns wide including row headings for tables. |
| JF | Color figures OK online (free). Color in print costs $500/page. Design for grayscale print compatibility. |
| Nature | Sans-serif fonts required (Helvetica/Arial). Override: plt.rcParams['font.family'] = 'sans-serif' |
jet, hsv) — not perceptually uniform, not colorblind-safe\&, \%, \_) in matplotlib text (titles, labels, annotations) — matplotlib's default text engine renders backslashes literally. Write plain S&P 500, not S\&P 500. LaTeX escapes only work when plt.rcParams['text.usetex'] = True, which requires a full LaTeX installation and is NOT enabled by default in our style.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
38 skills in this plugin
/audit-captionsAudit all table and figure captions for language, notation, and formatting consistency/audit-mathAdversarial audit of mathematical proofs, derivations, and formal environments/audit-sectionDeep audit of a single section -- style, factual accuracy, citations, logical flow/bond-dataReference for the Dickerson corporate bond dataset: column mappings between WRDS and PyBondLab, rating encoding, return definitions, signal clusters, and data gotchas. Auto-apply when loading bond data for PyBondLab analysis./build-contextGenerate guidance/paper-context.md from user-provided .tex, .md, or .pdf files/build-deckCreate and compile Beamer presentations following the Rhetoric of Decks philosophy. Use when making seminar or conference slides./ai-asset-pricing:publication-figuresfrom ai-asset-pricing
ai-asset-pricing@fin-skills is listed by howard-lynn-ye/fin-rsi — review the source before installing
npx claudepluginhub howard-lynn-ye/fin-rsi --plugin ai-asset-pricingOther plugins' skills for the same job