Earth & Environmental Sciences Publication Figures & 2D/3D Models (earthsci-figures)
An open-source hybrid R + Python SVG skill and code library for producing submission-grade quantitative figures (ggplot2 + patchwork) alongside local-to-regional 2D conceptual models and 3D oblique block diagrams (pure vector SVG with native gradients, USGS <pattern> fills, shaded relief, translucent water, numbered badges, and zoom insets) across Earth & Environmental Sciences.
Distilled from publication standards in Nature, Nature Geoscience, Nature Water, Nature Climate Change, and Nature Communications.
Read the modular references when needed:
references/visual-grammar.md— Nature-family R typography, four-sided inward ticks, palettes, and export bundle.references/schematics-2d-3d.md— Pure SVG 2D/3D block engine (python/svg_engine.py), projection math, USGS<pattern>fills, callouts, and insets.references/domain-conventions.md— Conventions for Climate/Cryosphere, Sedimentology/Stratigraphy, Igneous Petrology, Ecology/Environmental Science, and Hydrology/Hydrogeology.
1. Dual-Engine Architecture
| Engine | Best For | Key Files | Outputs |
|---|---|---|---|
R (ggplot2 + patchwork) | Quantitative multi-panel data figures, statistics, chemostratigraphy, spatial fields, time series, TAS/REE/EPMA, hydrographs | R/style_earthsci.R, R/schematics_helpers.R | Editable .svg (Arial), vector .pdf, optional 600-dpi .tiff, 300-dpi _preview.png, *_source_*.csv |
Python Vector SVG (svg_engine.py) | Local-to-regional 2D cross-sections and 3D oblique block diagrams with gradients, translucent water, USGS <pattern> fills, numbered badges, legends & zoom insets | python/svg_engine.py | Editable .svg (mm print units, Arial text) + 300/600-dpi .png via R::magick |
2. Mandatory Figure Contract (Draft Before Coding)
Core claim: One quantitative sentence with a verb and a number
Discipline: Climate-Cryosphere / Sedimentology-Stratigraphy / Igneous-Petrology /
Ecology-Environmental / Hydrology-Hydrogeology
Figure suite: Quantitative R figure + 2D conceptual cross-section (SVG) + 3D block diagram (SVG)
Target journal/size: e.g., Nature Geoscience double-column (183 × 104–124 mm)
Panel / model map: What unique question each panel or diagram answers
Uncertainty & stats: AR(1) n_eff, BH-FDR α, replicate-level display, 95% CI / IQR, U-Pb / EPMA σ
Source data exports: *_source_*.csv for every quantitative panel
Reviewer risk: Top 2 methodological or visual objections a peer reviewer could raise
Non-Negotiable Integrity Rules
- Compute from rawest data. Never hardcode summary numbers disconnected from the reproducible script.
- Never disguise schematics as measured data. Explicitly mark 2D/3D conceptual models as "Conceptual model (not to scale)".
- Zero sloppy stratigraphic geometry. Stratigraphic columns use strictly rectangular beds (horizontal contacts + perpendicular grain-size steps; wavy lines reserved strictly for scoured erosional surfaces such as SB) — never cartoonish diagonally sloped wedges.
- Honest uncertainty always. Account for autocorrelation (
trend_neff()), field multiplicity (fdr_mask()), and plot individual replicates behind summary means/medians. - Mandatory Visual QA (300 dpi). Open every rendered
*_preview.png(R and SVG alike) and eliminate every overlap of text on points, curves, arrows, polygons, or panel frames before delivering.
3. Standard Workflow (5 Steps)
- Runtime check: verify
Rscript(ggplot2,patchwork,dplyr,tidyr,tibble,scales,viridisLite,RColorBrewer,svglite,ragg,magick) and Python (numpy,scipy). - Write the Figure Contract (Section 2) and check
references/domain-conventions.md. - Build the quantitative R figure using
source("R/style_earthsci.R")and export*_source_*.csv+.svg/.pdf/_preview.png. - Build the local-to-regional 2D & 3D SVG models using
from svg_engine import SVG, Block3D, pchipwith CLI targets (2d | 3d | all). - Inspect every
*_preview.pngpixel-by-pixel; adjust coordinates and re-render until zero label collisions remain.