SSkilltecabyclaudinhocode
Enviar skill
← Voltar para o catálogo

ssci-plots

Dados e Análise

Publication-ready statistical figures for SSCI/SCI journals across psychology, economics, public health, sociology, political science, geography, methodology. Validated matplotlib styling, CVD-safe palettes (Tol, Okabe-Ito, ggsci, aesthetic sets), APA 7 formatting, 12 journal presets (APA, Elsevier, Wiley, SAGE, Psych Science, ASA, Nature, Science, NEJM, Lancet, BMJ, JAMA), 55+ chart types. Use wh

1estrelas
Ver no GitHub ↗Autor: O0000-codeLicença: MIT

SSCI Academic Figure Style

1. Core Principles

Three design commitments guide every figure this Skill produces:

  1. Data-ink ratio: Every pixel should convey data. Remove gridlines, 3D effects, and decorative elements -- they add visual noise without information value (Tufte, 1983). Use clean L-shaped axes (top and right spines off).

  2. Colorblind-safe and grayscale-compatible: About 8% of male readers have red-green color vision deficiency. Categorical palettes default to validated CVD-safe sets (Tol, 2021; Wong, 2011; Okabe & Ito, 2008) and pair color with a redundant channel (line style, marker shape, or hatching) so every figure remains readable in grayscale print. Journal-anchored palettes (NPG, AAAS, NEJM, Lancet, BMJ, JAMA) are provided to match house style at submission and are flagged with their CVD grade in list_palettes().

  3. Clean figure + separate text: The saved image contains only the data visualization (axes, data, legend). Figure number, title, and Note are output as standalone Markdown text for the user to place in the manuscript. This matches APA 7th Edition requirements and most journal submission guidelines where captions are supplied separately from image files.

Initialize the style system at the start of every figure:

from scripts.ssci_style import *
apply_style()                                # 70+ rcParams, colormaps, fonts
apply_style(journal='nejm')                  # Auto-loads matching palette + sizes
apply_style(journal='psych_science', mode='slides')  # Larger fonts for talks

2. Workflow

Step 1 -- Confirm Requirements

Before writing code, identify:

  • (a) Chart type from the decision table below (or its chart-family reference file)
  • (b) Target journal, if the user specifies one (12 presets available)
  • (c) Number of groups or conditions (determines palette size)
  • (d) Error metric: SE, SD, or 95% CI

Step 2 -- Initialize Style

Run apply_style() to set all rcParams, register colormaps, and embed fonts.

If the user specifies a target journal, pass it as an argument and read references/journal-presets.md for details:

# Available journal keys (12):
#   apa, elsevier, wiley, sage, psych_science, asa,
#   nature, science, nejm, lancet, bmj, jama
apply_style(journal='lancet')

apply_style(journal=...) also auto-loads the matching default palette via axes.prop_cycle (e.g. journal='nejm' activates the nejm palette). For slide / poster usage, add mode='slides' to bump font sizes without touching the underlying preset.

Step 3 -- Build the Figure

Open references/chart-type-guide.md first. It is the Index to the 55-chart catalog and routes you to one of the four chart-family files (chart-types-core.md, chart-types-models.md, chart-types-causal-econ.md, chart-types-applied.md) or the quick-reference file. Follow the design elements, parameters, and code patterns documented there.

Color selection:

  • Categorical data: get_palette(n) returns n CVD-safe hex colors (default: Tol Bright). Use category= / name= for discipline- or journal-anchored alternatives.
  • Emphasis focal + reference pair: get_emphasis_pair(focal=..., reference=...) returns two colors for "focal series vs neutral reference" patterns (treatment vs control, event-study, simple slopes).
  • Heatmap: get_diverging_cmap('BuRd') with TwoSlopeNorm(vcenter=0) for zero-centered diverging data.
  • Sequential data: get_sequential_cmap('viridis') (perceptually uniform); also cividis / plasma / inferno / magma / Blues / Oranges / tailwind_slate.
  • Multi-panel composition: see references/multi-panel.md for compose_grid / small_multiples / add_inset / shared legend & colorbar / marginal histogram.
  • Always pair color with redundant coding (LINE_STYLES, MARKERS, or HATCHES from ssci_style).

Step 4 -- Validate

Check every item in the Quality Checklist (Section 6 below) before saving.

If the figure includes statistical annotations (p-values, effect sizes, CI, inline statistics), read references/statistical-annotations.md for exact formatting rules. For APA figure text formatting details (number, title, Note, multi-panel conventions, mediation diagram conventions), read references/apa-figure-standards.md.

Step 5 -- Save and Output

Save the figure in multiple formats using save_figure():

save_figure(fig, 'fig_1')                          # Default: PDF + PNG (600 DPI)
save_figure(fig, 'fig_1', formats=('pdf', 'tiff')) # Journal submission (RGB TIFF)

Then output the figure description text separately as Markdown, using format_apa_figure_text():

text = format_apa_figure_text(
    figure_number=1,
    title="Mean Anxiety Scores by Treatment Condition and Time Point",
    note_text="N = 354. PSS = perceived stress scale; SWB = subjective well-being.",
    p_levels=[("*", ".05"), ("**", ".01"), ("***", ".001")],
    error_bar_type="95ci",                  # auto-emits standard error-bar statement
)

Output format:

Figure 1

Mean Anxiety Scores by Treatment Condition and Time Point

Note. N = 354. Error bars represent 95% confidence intervals. PSS = perceived stress scale; SWB = subjective well-being.

*p < .05. **p < .01. ***p < .001.


3. Chart Type Selection

The full catalog has 55 chart types organized by family. Use this top-level table for routing; then load the chart-family file for the detailed 6-section spec.

3.1 By chart family

FamilyFileChart sections (representative)
Core distribution & relationshipchart-types-core.md§1 Grouped Bar, §2 Error Bar, §3 Line, §3.1 Annotated Time Series, §4 Scatter+Regression, §4.1 Scatter with Marginal Histogram, §5 Box, §6 Violin, §7 Correlation Heatmap
Statistical model outputchart-types-models.md§8 Forest, §8.1 Coefficient/Dot-Whisker, §9 Path/SEM, §9.1 IV Diagram, §10 Mediation (incl. §10.1 Serial, §10.2 Parallel), §11 Interaction, §11.1 Categorical Moderator, §11.2 Continuous Marginal Effect, §12 Simple Slopes, §17 Scree+Parallel Analysis, §18 Profile (LPA/LCA), §19 Growth Curve, §32 Specification Curve, §33 Causal DAG
Causal inference / econometricschart-types-causal-econ.md§22 Event-Study Coefficient Plot, §23 DID Parallel Trends, §24 Regression Discontinuity, §25 Binned Scatter (Binscatter), §26 Coefficient Plot multi-model, §38 IV Diagram
Applied / specialtychart-types-applied.md§14 Raincloud, §16 Funnel, §20 Kaplan-Meier (with at-risk table), §21 Bland-Altman, §27 Ridgeline/Joy, §28 Choropleth, §29 ROC + Calibration, §30 Mobility Transition Matrix, §31 Marginal Effects
Quick reference (one-page each)chart-types-quick-reference.md§15.1 Histogram, §15.2 Density (KDE), §15.3 Swarm/Beeswarm, §15.4 Factor Loading, §15.5 Johnson-Neyman, §15.6 CONSORT, §15.7 Lollipop, §15.8 Slope/Bump, §15.9 Dumbbell, §15.10 Population Pyramid, §15.11 Tornado/Butterfly
Multi-panel compositionmulti-panel.mdcompose_grid, small_multiples, add_inset, shared legend/colorbar, marginal histogram, subfigures

3.2 By discipline (decision shortcut)

DisciplinePrimary chart-family file
Psychology — descriptivechart-types-core.md
Psychology — modeling (SEM, mediation, forest, simple slopes, growth)chart-types-models.md
Economics — causal (event-study, DID, RD, IV, binscatter)chart-types-causal-econ.md
Public health & medicine (KM, ROC, funnel, Bland-Altman)chart-types-applied.md
Sociology (mobility matrix, ridgeline)chart-types-applied.md
Political science (annotated time series, ideological scaling, choropleth)chart-types-applied.md + chart-types-core.md §3.1
Geography (choropleth, spatial overlays)chart-types-applied.md
Methodology / robustness (specification curve, DAG)chart-types-models.md

3.3 Cross-cutting routing table

| Data /

Como adicionar

/plugin marketplace add O0000-code/SSCI-Plots

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Comentários · Nenhum comentário

Entre para comentar. Entrar

  • Ainda não há comentários. Seja o primeiro.