One call, publication-ready figure.
- 🎯 12 journal presets —
apply_style(journal="lancet")configures matplotlib to match a journal's house style. APA, Elsevier, Wiley, SAGE, Psychological Science, OUP / ASA, Nature, Science, NEJM, Lancet, BMJ, JAMA. - 🎨 21 color-blind-safe palettes — drawn from Tol, Okabe-Ito, ggsci, MetBrewer, Economist, BBC. Fonts are embedded, Latin statistics italicized.
- 🧰 27 helpers — significance brackets, inline statistics, reference lines, and multi-panel composition (
compose_grid,small_multiples, shared colorbar / legend, inset zoom). - 📄 APA 7 output — image file plus a separate Markdown caption. Figure number, title, and Note stay out of the image itself.
- 🌐 Cross-disciplinary — psychology, economics, public health, sociology, political science, geography, education, methodology.
Eighteen worked examples grouped by discipline. Switch presets by changing one argument to apply_style(). To regenerate locally: python examples/generate_examples.py.
Grouped bar with significance brackets, mediation diagram, correlation heatmap, interaction plot, and raincloud.
Forest plot, multi-panel composite, and specification curve.
Event-study DID, regression discontinuity, mobility transition matrix, and a multi-model coefficient plot.
Survival curve, ideological scaling, geographic distribution, and growth trajectories.
I used to spend hours on every submission tuning matplotlib by hand: font size, spines, palette, column width. Reviewers still flagged the figures. So I sat down with the author guidelines for APA, Elsevier, Wiley, SAGE, OUP, Nature, Science, NEJM, Lancet, BMJ, and JAMA, read the color-vision-deficiency papers from Tol, Wong, and Okabe & Ito, and worked through how ggsci, MetBrewer, The Economist, BBC News, and the UK Government Analysis Function set up their charts. Everything I learned went into a single style file.
SSCI-Plots is that file plus the helpers I kept reaching for. Coverage now extends past psychology into economics, public health, sociology, political science, education, business and management, geography, and methodology.
Clone the repo into Claude Code's skills folder:
git clone https://github.com/O0000-code/SSCI-Plots.git ~/.claude/skills/ssci-plotsClaude Code picks the skill up automatically. When you ask for a publication-ready figure, the agent calls apply_style(...), get_palette(...), compose_grid(...), and so on. SKILL.md at the repo root tells the model when to use which helper.
Dependencies: matplotlib >= 3.5, numpy, pillow. The agent installs anything missing.
Want to call the library directly without Claude Code? See Use as a Python library below.
- 12 journal presets with matching palettes — APA, Elsevier, Wiley, SAGE, Psychological Science, OUP / ASA, Nature, Science, NEJM, Lancet, BMJ, JAMA
- 21 color-blind-safe categorical palettes — Tol, Okabe-Ito, IBM, ggsci, MetBrewer, Economist, BBC. Another 17 mood palettes ship for non-publication use, behind an explicit opt-in.
- 3 diverging and 8 sequential colormaps — BuRd, PRGn, the viridis family, and ColorBrewer; all registered with matplotlib
- 70+ matplotlib rcParams — APA 7 italics, custom mathtext, TrueType embedding, journal-specific panel labels
- 27 helpers and a 55-chart catalog — see the API list below and
references/docs - 30 named figure sizes plus
mode='slides'for posters and talks
27 helper functions — style · palettes · APA formatting · statistical annotations · multi-panel composition
Style entry points (3)
apply_style(journal=None, *, mode='paper')-- one call sets 70+ rcParams, registers colormaps, embeds TrueType fonts, and loads the matching palette when a journal is givenfig_size(width_cm, height_cm)-- converts cm to inches against journal column widthsave_figure(fig, name)-- writes PDF, PNG, or both at the default DPI defined inssci_style.py
Palette access (7)
get_palette(n, name='tol_bright', *, category=None, return_emphasis=False)-- n color-blind-safe categorical colorsget_grayscale(n)-- grayscale fallback for printget_diverging_cmap(name='BuRd')-- diverging colormap for heatmapsget_sequential_cmap(name='viridis')-- perceptually uniform sequential colormap (viridis family, ColorBrewer, Tailwind monochromatic)list_palettes(category=None, publication_grade=None)-- list available palettes with metadataget_emphasis_pair(focal=None, *, reference=...)-- one saturated color plus a neutral gray for treatment-vs-control comparisons (reference defaults to the gray set inssci_style.py)register_aesthetic_palette(name, *, acknowledge_non_publication_grade=True)-- opt-in switch for the 17 mood palettes
APA p-value and figure-text formatting (3)
format_p_value(p, style='apa')-- APA-formatted p (no leading zero, three decimals;'stars'and'exact'modes too)p_to_stars(p)--***/**/*/n.s.format_apa_figure_text(figure_number, title, note_text=None, *, error_bar_type=None, model_fit=None)-- APA figure number / title / Note as Markdown, with optional structured note for error bars and SEM model fit
Statistical annotations (4)
add_significance_bracket(ax, x1, x2, y, p_value)-- bracket with automatic p-to-stars conversionannotate_effect_size(ax, d, ci=None)-- effect size with optional CIadd_inline_stats(ax, items, position='top_left')-- inline block of test statistics, the kind seen in replication packages from major journalsadd_reference_line(ax, value, orientation='horizontal')-- horizontal or vertical reference line with optional label
Axes, legend, panel labels (3)
remove_spines(ax)-- removes the top and right spinessetup_legend(ax, **kw)-- frameless legend in Title Caseadd_panel_labels(axes, *, journal=None, prefix='', suffix='', overlay_bg=None)-- A / B / C panel labels in the case and size each journal expects, with per-journal overrides
Multi-panel composition (4)
compose_grid(layout, figsize='full_width', *, share=False, panel_labels='auto', ...)-- rectangular mosaic layouts ("ABC","AB;CD","AAB\nCDB"); raisesSSCIPlotsMosaicErrorfor non-rectangular shapessmall_multiples(n_rows, n_cols, *, share='all', panel_labels='auto', ...)-- N x M facet grid with shared axes by defaultadd_inset(ax, bbox=(0.55, 0.55, 0.4, 0.4), *, xlim=None, ylim=None, zoom_indicator=False)-- inset axes with an optional zoom rectangle and connector linescompose_subfigures(n_rows, n_cols, *, height_ratios=None)-- stacked sub-figure regions for cases where each region needs its own colorbar or legend
Cross-panel helpers (3)
add_marginal_hist(ax, x, y, *, kind='hist'|'kde', size='20%')-- marginal histograms or KDEs along a scatteradd_shared_colorbar(fig, mappable, axes, *, location='right', shrink=0.7)-- one colorbar shared across several axesadd_shared_legend(fig, handles_or_axes, *, loc='lower center', ncol=None, region=None)-- deduplicated legend attached to the figure rather than to a single axes
Reference docs (loaded by Claude Code on demand):
references/chart-type-guide.md-- index to the 55-chart catalog across psychology, economics, public health, sociology, political science, geography, and methodologyreferences/chart-types-core.md-- bar, scatter, line with CI, box, violin, raincloud, and correlation heatmapreferences/chart-types-models.md-- forest, path / SEM, mediation, interaction, simple slopes, IV diagram, scree, profile / LPA, growth curve, specification curve, causal DAGreferences/chart-types-causal-econ.md-- event-study, DID parallel trends, regression discontinuity, binscatter, and the multi-model coefficient plotreferences/chart-types-applied.md-- Kaplan-Meier, ridgeline, choropleth, ROC and calibration, Bland-Altman, mobility transition matrix, marginal effectsreferences/chart-types-quick-reference.md-- 11 additional chart types (histogram, KDE, swarm, factor loading, Johnson-Neyman, CONSORT, lollipop, slope / bump, dumbbell, population pyramid, tornado)references/multi-panel.md-- how to choose between 1xN, 2xN, mosaic, and asymmetric layouts; shared colorbar and legend; inset zoom; marginal histogramsreferences/color-system.md-- choosing a palette, evaluating color-blind safety across all 21 palettes, and using saturated-plus-gray pairs for emphasisreferences/complexity-elements-catalog.md-- 30 small annotation elements (inline stats, reference lines, at-risk tables, and so on) with discipline defaults and a back-reference to the 18 example figuresreferences/apa-figure-standards.md-- APA 7 figure rules, including conventions for mediation diagrams, raincloud Note requirements, in-figure annotations, and a cross-walk between APA 7 and journal house stylesreferences/journal-presets.md-- per-publisher specs for all 12 presetsreferences/statistical-annotations.md-- significance brackets, effect sizes, and inline statistics conventions
The skill layer above only handles discovery for Claude Code. To call SSCI-Plots directly from a Jupyter notebook, script, or another tool:
git clone https://github.com/O0000-code/SSCI-Plots.git
cd SSCI-Plots
pip install matplotlib numpy pillowfrom scripts.ssci_style import apply_style, get_palette, compose_grid, save_figure
apply_style(journal="lancet") # configures matplotlib + loads the Lancet palette
fig, axes = compose_grid("AB;CD", figsize="full_width")
# ... plot into axes['A'] / axes['B'] / axes['C'] / axes['D']
save_figure(fig, "fig_2") # writes fig_2.pdf and fig_2.pngSee SKILL.md for the full helper API. A pip install package is on the roadmap.
A companion skill, deep-literature-search, is in progress and should land around the same time.
This is a hobby project. Issue response is typically a week or two; PR review can be slower. Bug reports with a minimal reproduction are the most useful. See CONTRIBUTING.md.
MIT. See LICENSE.

















