terraproof 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +356 -2
- package/bin/terraproof.js +4 -0
- package/dist/router/apply.js +147 -0
- package/dist/router/classify.js +111 -0
- package/dist/router/explain.js +9 -0
- package/dist/router/index.js +272 -0
- package/dist/router/resolve.js +239 -0
- package/dist/router/score.js +60 -0
- package/dist/router/types.js +1 -0
- package/dist/router/validate.js +81 -0
- package/instructions/engineering.md +14 -0
- package/instructions/security.md +14 -0
- package/instructions/simplicity.md +13 -0
- package/package.json +65 -4
- package/routing/DOMAIN_ROUTING.md +161 -0
- package/routing/ROUTER_DESIGN.md +173 -0
- package/routing/SKILL_MANIFEST.md +86 -0
- package/routing/checks.json +121 -0
- package/routing/collections.json +47 -0
- package/routing/registry.json +2211 -0
- package/routing/rules.json +64 -0
- package/skills/accuracy-assessment/SKILL.md +213 -0
- package/skills/accuracy-assessment/UPSTREAM.md +7 -0
- package/skills/accuracy-assessment/references/stratified-estimator.md +127 -0
- package/skills/accuracy-assessment/skill.json +103 -0
- package/skills/brainstorming/SKILL.md +250 -0
- package/skills/brainstorming/UPSTREAM.md +29 -0
- package/skills/brainstorming/scripts/frame-template.html +213 -0
- package/skills/brainstorming/scripts/helper.js +167 -0
- package/skills/brainstorming/scripts/server.cjs +723 -0
- package/skills/brainstorming/scripts/start-server.sh +209 -0
- package/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/skills/brainstorming/skill.json +73 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +299 -0
- package/skills/crs-and-units/SKILL.md +200 -0
- package/skills/crs-and-units/UPSTREAM.md +7 -0
- package/skills/crs-and-units/skill.json +74 -0
- package/skills/design-postgis-tables/SKILL.md +494 -0
- package/skills/design-postgis-tables/UPSTREAM.md +21 -0
- package/skills/design-postgis-tables/skill.json +90 -0
- package/skills/gdal/SKILL.md +125 -0
- package/skills/gdal/UPSTREAM.md +22 -0
- package/skills/gdal/references/gdal-recipes.md +103 -0
- package/skills/gdal/skill.json +66 -0
- package/skills/geomaster/README.md +105 -0
- package/skills/geomaster/SKILL.md +366 -0
- package/skills/geomaster/UPSTREAM.md +21 -0
- package/skills/geomaster/references/advanced-gis.md +376 -0
- package/skills/geomaster/references/big-data.md +363 -0
- package/skills/geomaster/references/code-examples.md +531 -0
- package/skills/geomaster/references/coordinate-systems.md +364 -0
- package/skills/geomaster/references/core-libraries.md +273 -0
- package/skills/geomaster/references/data-sources.md +330 -0
- package/skills/geomaster/references/gis-software.md +369 -0
- package/skills/geomaster/references/industry-applications.md +420 -0
- package/skills/geomaster/references/machine-learning.md +462 -0
- package/skills/geomaster/references/programming-languages.md +456 -0
- package/skills/geomaster/references/remote-sensing.md +370 -0
- package/skills/geomaster/references/scientific-domains.md +416 -0
- package/skills/geomaster/references/specialized-topics.md +428 -0
- package/skills/geomaster/references/troubleshooting.md +439 -0
- package/skills/geomaster/skill.json +157 -0
- package/skills/geopandas/SKILL.md +250 -0
- package/skills/geopandas/UPSTREAM.md +22 -0
- package/skills/geopandas/references/crs-management.md +231 -0
- package/skills/geopandas/references/data-io.md +323 -0
- package/skills/geopandas/references/data-structures.md +207 -0
- package/skills/geopandas/references/geometric-operations.md +262 -0
- package/skills/geopandas/references/spatial-analysis.md +294 -0
- package/skills/geopandas/references/visualization.md +230 -0
- package/skills/geopandas/scripts/_common.py +605 -0
- package/skills/geopandas/scripts/crs_reprojection_plan.py +210 -0
- package/skills/geopandas/scripts/export_plan.py +305 -0
- package/skills/geopandas/scripts/geometry_validity_report.py +227 -0
- package/skills/geopandas/scripts/sensitive_coordinates_checklist.py +230 -0
- package/skills/geopandas/scripts/spatial_join_audit.py +368 -0
- package/skills/geopandas/scripts/vector_inventory.py +140 -0
- package/skills/geopandas/skill.json +116 -0
- package/skills/geoparquet-validation/SKILL.md +125 -0
- package/skills/geoparquet-validation/UPSTREAM.md +24 -0
- package/skills/geoparquet-validation/references/distribution-best-practices.md +118 -0
- package/skills/geoparquet-validation/references/gpio-commands.md +264 -0
- package/skills/geoparquet-validation/references/tool-comparison.md +155 -0
- package/skills/geoparquet-validation/skill.json +71 -0
- package/skills/geospatial-data-discovery/SKILL.md +49 -0
- package/skills/geospatial-data-discovery/UPSTREAM.md +15 -0
- package/skills/geospatial-data-discovery/skill.json +51 -0
- package/skills/geospatial-frontend/SKILL.md +86 -0
- package/skills/geospatial-frontend/UPSTREAM.md +23 -0
- package/skills/geospatial-frontend/references/design-system.md +283 -0
- package/skills/geospatial-frontend/references/user-preferences.md +96 -0
- package/skills/geospatial-frontend/skill.json +87 -0
- package/skills/geozarr/SKILL.md +244 -0
- package/skills/geozarr/UPSTREAM.md +21 -0
- package/skills/geozarr/skill.json +97 -0
- package/skills/networkx/SKILL.md +440 -0
- package/skills/networkx/UPSTREAM.md +22 -0
- package/skills/networkx/references/algorithms.md +384 -0
- package/skills/networkx/references/generators.md +385 -0
- package/skills/networkx/references/graph-basics.md +284 -0
- package/skills/networkx/references/io.md +457 -0
- package/skills/networkx/references/visualization.md +531 -0
- package/skills/networkx/skill.json +93 -0
- package/skills/raster-processing/SKILL.md +222 -0
- package/skills/raster-processing/UPSTREAM.md +7 -0
- package/skills/raster-processing/skill.json +81 -0
- package/skills/sar-basics/SKILL.md +202 -0
- package/skills/sar-basics/UPSTREAM.md +7 -0
- package/skills/sar-basics/references/calibration-lut.md +98 -0
- package/skills/sar-basics/skill.json +97 -0
- package/skills/satellite-preprocessing/SKILL.md +241 -0
- package/skills/satellite-preprocessing/UPSTREAM.md +7 -0
- package/skills/satellite-preprocessing/skill.json +84 -0
- package/skills/scientific-visualization/SKILL.md +285 -0
- package/skills/scientific-visualization/UPSTREAM.md +25 -0
- package/skills/scientific-visualization/assets/color_palettes.py +263 -0
- package/skills/scientific-visualization/assets/nature.mplstyle +68 -0
- package/skills/scientific-visualization/assets/presentation.mplstyle +68 -0
- package/skills/scientific-visualization/assets/publication.mplstyle +77 -0
- package/skills/scientific-visualization/assets/publisher_profiles.json +269 -0
- package/skills/scientific-visualization/references/color_palettes.md +227 -0
- package/skills/scientific-visualization/references/journal_requirements.md +169 -0
- package/skills/scientific-visualization/references/matplotlib_examples.md +336 -0
- package/skills/scientific-visualization/references/publication_guidelines.md +196 -0
- package/skills/scientific-visualization/references/sources.md +76 -0
- package/skills/scientific-visualization/scripts/_common.py +136 -0
- package/skills/scientific-visualization/scripts/export_plan.py +493 -0
- package/skills/scientific-visualization/scripts/figure_export.py +642 -0
- package/skills/scientific-visualization/scripts/image_metadata.py +731 -0
- package/skills/scientific-visualization/scripts/palette_audit.py +327 -0
- package/skills/scientific-visualization/scripts/style_presets.py +501 -0
- package/skills/scientific-visualization/scripts/style_preview.py +232 -0
- package/skills/scientific-visualization/skill.json +95 -0
- package/skills/spectral-indices/SKILL.md +235 -0
- package/skills/spectral-indices/UPSTREAM.md +7 -0
- package/skills/spectral-indices/skill.json +88 -0
- package/skills/stac-and-cloud-access/SKILL.md +209 -0
- package/skills/stac-and-cloud-access/UPSTREAM.md +7 -0
- package/skills/stac-and-cloud-access/references/run-manifest.md +94 -0
- package/skills/stac-and-cloud-access/skill.json +98 -0
- package/skills/statistical-analysis/SKILL.md +446 -0
- package/skills/statistical-analysis/UPSTREAM.md +24 -0
- package/skills/statistical-analysis/references/assumptions_and_diagnostics.md +379 -0
- package/skills/statistical-analysis/references/bayesian_statistics.md +686 -0
- package/skills/statistical-analysis/references/effect_sizes_and_power.md +649 -0
- package/skills/statistical-analysis/references/reporting_standards.md +482 -0
- package/skills/statistical-analysis/references/test_selection_guide.md +129 -0
- package/skills/statistical-analysis/scripts/assumption_checks.py +652 -0
- package/skills/statistical-analysis/skill.json +127 -0
- package/skills/systematic-debugging/SKILL.md +283 -0
- package/skills/systematic-debugging/UPSTREAM.md +28 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +72 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/skill.json +88 -0
- package/skills/time-series-and-change/SKILL.md +217 -0
- package/skills/time-series-and-change/UPSTREAM.md +7 -0
- package/skills/time-series-and-change/references/change-methods.md +42 -0
- package/skills/time-series-and-change/skill.json +116 -0
- package/skills/vector-quality/SKILL.md +204 -0
- package/skills/vector-quality/UPSTREAM.md +7 -0
- package/skills/vector-quality/skill.json +82 -0
- package/skills/verification/SKILL.md +120 -0
- package/skills/verification/UPSTREAM.md +31 -0
- package/skills/verification/skill.json +67 -0
- package/skills/writing-plans/SKILL.md +171 -0
- package/skills/writing-plans/UPSTREAM.md +23 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-plans/skill.json +80 -0
- package/sources/SOURCES.md +374 -0
- package/third_party/isaaccorley-geospatial-skills/LICENSE +176 -0
- package/third_party/isaaccorley-geospatial-skills/NOTICE.md +17 -0
- package/third_party/kdense-scientific-agent-skills/LICENSE +21 -0
- package/third_party/kdense-scientific-agent-skills/NOTICE.md +19 -0
- package/third_party/superpowers/LICENSE +21 -0
- package/third_party/superpowers/NOTICE.md +17 -0
- package/third_party/timescale-pg-aiguide/LICENSE +176 -0
- package/third_party/timescale-pg-aiguide/NOTICE.md +14 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Publication Figure Principles
|
|
2
|
+
|
|
3
|
+
Reviewed 2026-07-23. These are general scientific-communication principles, not publisher requirements. Date-sensitive rules belong in `journal_requirements.md`. Source IDs resolve in `sources.md`.
|
|
4
|
+
|
|
5
|
+
## Preserve evidence before styling
|
|
6
|
+
|
|
7
|
+
Keep three layers separate:
|
|
8
|
+
|
|
9
|
+
1. **Raw/source data**: immutable originals, acquisition metadata, exclusions, and missing-value codes.
|
|
10
|
+
2. **Transformation record**: executable code or a machine-readable log of filtering, normalization, aggregation, statistical estimation, image processing, and random seeds.
|
|
11
|
+
3. **Presentation output**: the figure and an export manifest recording dimensions, format, package versions, and source references.
|
|
12
|
+
|
|
13
|
+
Do not overwrite raw images or tabular data. Keep native-resolution images. Upsampling changes pixel count, not information; PLOS, Science, Nature, Cell Press, Elsevier, and IEEE explicitly warn against treating it as improved quality [PLOS-FIG] [SCIENCE-REVISED] [NATURE-FINAL] [CELL-FIG] [ELSEVIER-SIZE] [IEEE-SIZE].
|
|
14
|
+
|
|
15
|
+
For experimental/observational images:
|
|
16
|
+
|
|
17
|
+
- Apply necessary brightness, contrast, and color adjustments consistently to the whole image unless a disclosed scientific method requires otherwise.
|
|
18
|
+
- Never selectively erase, obscure, clone, or enhance features.
|
|
19
|
+
- Preserve background and nonspecific signal.
|
|
20
|
+
- Mark and explain splices, omitted lanes, composites, or stitched fields.
|
|
21
|
+
- Retain originals and the exact processing steps. Some publishers request originals during review or production [CELL-FIG] [PLOS-FIG].
|
|
22
|
+
|
|
23
|
+
The bundled exporter can write a provenance manifest, but it cannot confirm that supplied provenance is complete.
|
|
24
|
+
|
|
25
|
+
## Avoid visual deception
|
|
26
|
+
|
|
27
|
+
### Baselines and context
|
|
28
|
+
|
|
29
|
+
- **Bars and filled areas encode length/area from a baseline**: normally show the zero baseline. If a nonzero reference is scientifically meaningful, make that reference explicit and avoid implying absolute magnitude.
|
|
30
|
+
- **Points and lines encode position**: a nonzero axis limit can be valid, but show enough context, disclose breaks, and avoid choosing limits solely to magnify a small effect.
|
|
31
|
+
- Use common limits for panels intended for direct comparison. If limits differ, make the difference unmistakable.
|
|
32
|
+
- Do not extend axes far beyond observed data merely to suppress visible variation; Science explicitly advises that scales not extend beyond plotted data [SCIENCE-INITIAL].
|
|
33
|
+
|
|
34
|
+
### Uncertainty and raw observations
|
|
35
|
+
|
|
36
|
+
- Do not add error bars mechanically. Show uncertainty when an estimate is displayed, and show spread when the distribution is the question.
|
|
37
|
+
- Name the interval precisely: SD, SE, percentile interval, parametric CI, bootstrap CI, posterior interval, or another definition.
|
|
38
|
+
- State sample size, unit of replication, estimator, interval level, and dependence/repeated-measure handling.
|
|
39
|
+
- Use deterministic seeds for bootstrap displays. Seaborn 0.13.2 supports `errorbar="sd"`, `"se"`, `"pi"`, `"ci"`, tuples such as `("ci", 95)`, or a callable; bootstrap results vary unless `seed` is set [SEABORN-ERROR].
|
|
40
|
+
- Show raw observations when feasible. Do not jitter points so far that their category or value becomes ambiguous.
|
|
41
|
+
- Significance stars are not uncertainty. Add them only for a reported analysis, identify the test and multiplicity handling, and provide exact values where practical.
|
|
42
|
+
|
|
43
|
+
### Missing, excluded, and censored data
|
|
44
|
+
|
|
45
|
+
- Keep missing values distinct from zero, below-detection-limit values, and excluded observations.
|
|
46
|
+
- Do not silently connect across missing time points. Use a gap, explicit interpolation style, or a model curve whose status is stated.
|
|
47
|
+
- Give missing values a dedicated legend entry or neutral `bad` colormap color.
|
|
48
|
+
- Record exclusions and their rationale outside the plotting code as well as in the caption/methods.
|
|
49
|
+
|
|
50
|
+
### Area, volume, and 3D encodings
|
|
51
|
+
|
|
52
|
+
- Prefer position on a common scale.
|
|
53
|
+
- If area represents magnitude, scale **area**, not radius. If volume represents magnitude, scale volume, not diameter.
|
|
54
|
+
- Avoid perspective 3D bars, pies, and surfaces for simple comparisons; occlusion and perspective distort values.
|
|
55
|
+
- If a true 3D scientific structure is necessary, add orthogonal views, scale/orientation cues, and accessible alternatives.
|
|
56
|
+
|
|
57
|
+
### Logarithms and other transforms
|
|
58
|
+
|
|
59
|
+
- Label the transformed scale and base. Say whether values, axes, or model outputs were transformed.
|
|
60
|
+
- A logarithmic axis requires a declared policy for zero and negative values; never silently discard them.
|
|
61
|
+
- Interpret equal distances as ratios, not additive differences.
|
|
62
|
+
- For signed data around zero, consider `SymLogNorm`/a symmetric log axis with a disclosed linear region; for unequal ranges around a meaningful center, consider `TwoSlopeNorm` [MPL-NORM].
|
|
63
|
+
- Power-law or arbitrary transforms need strong justification and conspicuous disclosure. Matplotlib itself notes that viewers are less familiar with power normalization [MPL-NORM].
|
|
64
|
+
|
|
65
|
+
### Binning, smoothing, and aggregation
|
|
66
|
+
|
|
67
|
+
- Record bin edges, inclusion convention, bandwidth/window, smoothing method, and whether choices were made before seeing the result.
|
|
68
|
+
- Show sensitivity to reasonable bin or bandwidth choices when conclusions depend on them.
|
|
69
|
+
- Do not use interpolation or smoothing to imply observations between measured points.
|
|
70
|
+
- Preserve and, where practical, expose underlying observations.
|
|
71
|
+
|
|
72
|
+
### Normalization and color limits
|
|
73
|
+
|
|
74
|
+
- State the formula and reference: per-capita, percent of baseline, z-score axis, library-size factor, min-max range, or other transformation.
|
|
75
|
+
- Fit normalization parameters on the appropriate data partition; avoid information leakage.
|
|
76
|
+
- Use the same normalization and color limits across directly compared panels unless the difference is explicit.
|
|
77
|
+
- A diverging map needs a scientifically meaningful center. `Normalize`, `LogNorm`, `CenteredNorm`, `SymLogNorm`, `TwoSlopeNorm`, and `BoundaryNorm` encode different assumptions [MPL-NORM].
|
|
78
|
+
- Always label colorbars with units and transformed scale.
|
|
79
|
+
|
|
80
|
+
### Dual axes
|
|
81
|
+
|
|
82
|
+
Prefer aligned panels or normalized/common-unit displays. Dual y-axes can make unrelated series appear correlated because each range can be tuned independently. If unavoidable:
|
|
83
|
+
|
|
84
|
+
- justify the shared x-domain and distinct units;
|
|
85
|
+
- label each axis and series directly;
|
|
86
|
+
- avoid matching colors as the only association cue;
|
|
87
|
+
- choose limits independently of the desired visual relationship;
|
|
88
|
+
- provide the underlying data.
|
|
89
|
+
|
|
90
|
+
### Image contrast and channels
|
|
91
|
+
|
|
92
|
+
- Inspect histograms and clipped-pixel counts before and after adjustment.
|
|
93
|
+
- Apply comparable processing to images being compared.
|
|
94
|
+
- State channel assignment, lookup table, projection, denoising, deconvolution, thresholding, and contrast limits.
|
|
95
|
+
- Use scale bars based on calibration, not magnification text.
|
|
96
|
+
- Do not rely on red/green channel identity alone; use accessible channel combinations, outlines, labels, or separate grayscale panels.
|
|
97
|
+
|
|
98
|
+
## Encoding and color
|
|
99
|
+
|
|
100
|
+
Match the palette to data:
|
|
101
|
+
|
|
102
|
+
- **Qualitative** for unordered categories; do not imply order.
|
|
103
|
+
- **Sequential** for ordered magnitude.
|
|
104
|
+
- **Diverging** only when a meaningful midpoint exists.
|
|
105
|
+
- **Cyclic** for periodic variables such as direction or phase.
|
|
106
|
+
|
|
107
|
+
Use hue consistently across a manuscript. Avoid rainbow maps for ordered data unless there is a documented scientific reason and the map has been evaluated for perceptual artifacts. Paul Tol explains why ordinary rainbow schemes create false transitions and fail for some color-vision conditions [TOL].
|
|
108
|
+
|
|
109
|
+
Color is not a sufficient encoding:
|
|
110
|
+
|
|
111
|
+
- combine it with marker shape, line style, hatching, direct labels, or panel separation;
|
|
112
|
+
- audit contrast against the actual background;
|
|
113
|
+
- inspect grayscale, but do not treat grayscale conversion as a complete color-vision simulation;
|
|
114
|
+
- keep legends ordered like the data or direct-label series.
|
|
115
|
+
|
|
116
|
+
See `color_palettes.md` and run `scripts/palette_audit.py`.
|
|
117
|
+
|
|
118
|
+
## Accessibility
|
|
119
|
+
|
|
120
|
+
WCAG 2.2 is a web-content standard, not a journal-print specification. It provides useful targets for figures delivered on the web [WCAG22]:
|
|
121
|
+
|
|
122
|
+
- SC 1.4.1 (Level A): color is not the only visual means of conveying information.
|
|
123
|
+
- SC 1.4.3 (Level AA): normal text has at least 4.5:1 contrast; large text has at least 3:1, with stated exceptions.
|
|
124
|
+
- SC 1.4.11 (Level AA): graphical objects required to understand content have at least 3:1 contrast against adjacent colors, with an essential-presentation exception.
|
|
125
|
+
- SC 1.1.1 (Level A): non-text content has an equivalent text alternative.
|
|
126
|
+
- SC 1.4.5 (Level AA): use actual text rather than images of text when the technology can provide it, subject to exceptions.
|
|
127
|
+
|
|
128
|
+
For web/interactive figures also provide:
|
|
129
|
+
|
|
130
|
+
- a concise alt text naming chart type, variables, main pattern, and important exception;
|
|
131
|
+
- a long description or nearby narrative for complex figures;
|
|
132
|
+
- the underlying data in an accessible table/download;
|
|
133
|
+
- keyboard-operable interactions, visible focus, and non-hover access to values;
|
|
134
|
+
- a static fallback that preserves the scientific message.
|
|
135
|
+
|
|
136
|
+
Passing a palette ratio audit does not prove WCAG conformance; applicability depends on rendered context and alternatives.
|
|
137
|
+
|
|
138
|
+
## Layout, typography, and annotation
|
|
139
|
+
|
|
140
|
+
- Design at final physical size. Judge labels, symbols, and line weights at that size.
|
|
141
|
+
- Use one legible font family and a restrained size hierarchy.
|
|
142
|
+
- Include units in axis/colorbar labels. Define abbreviations.
|
|
143
|
+
- Keep panel labels consistent and outside dense data regions.
|
|
144
|
+
- Use layout engines intentionally: `layout="constrained"` handles nested grids and colorbars; calling `tight_layout()` disables constrained layout [MPL-LAYOUT].
|
|
145
|
+
- Check all labels and legends after export. `bbox_inches="tight"` can alter physical page dimensions, so do not use it when exact page width is required [MPL-SAVE].
|
|
146
|
+
- Keep decorative ink subordinate to data, uncertainty, and annotations. Gridlines can help value lookup when light and sparse; removing them is not a universal rule.
|
|
147
|
+
|
|
148
|
+
## Static, vector, raster, and interactive output
|
|
149
|
+
|
|
150
|
+
### Vector
|
|
151
|
+
|
|
152
|
+
PDF/SVG/EPS are useful for text and line art, but a vector container may include rasterized artists. DPI still controls those raster elements [MPL-SAVE]. Dense scatter plots can be selectively rasterized to control file size while preserving vector text/axes.
|
|
153
|
+
|
|
154
|
+
For Matplotlib:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
import matplotlib as mpl
|
|
158
|
+
|
|
159
|
+
mpl.rcParams["pdf.fonttype"] = 42
|
|
160
|
+
mpl.rcParams["ps.fonttype"] = 42
|
|
161
|
+
mpl.rcParams["svg.fonttype"] = "none"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
PDF/PS Type 42 embeds TrueType fonts. `svg.fonttype="none"` leaves text as text and therefore depends on font availability; `svg.fonttype="path"` trades editability/searchability for appearance portability [MPL-STYLE]. Inspect the delivered file rather than assuming font behavior.
|
|
165
|
+
|
|
166
|
+
### Raster
|
|
167
|
+
|
|
168
|
+
Required pixel width is:
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
pixels = final width (inches) × target pixels per inch
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Embedded DPI metadata alone does not add detail. TIFF/PNG are lossless choices; JPEG can be accepted by some publishers for photographs but is a poor choice for line art or text because it is lossy. Preserve original bit depth and color profile when scientifically important.
|
|
175
|
+
|
|
176
|
+
Transparency can reveal an unintended background or change apparent contrast. Matplotlib's `transparent=True` makes axes patches transparent and, unless explicitly overridden, the figure patch too [MPL-SAVE]. Prefer an explicit opaque background for submission unless the destination requires transparency.
|
|
177
|
+
|
|
178
|
+
### Plotly
|
|
179
|
+
|
|
180
|
+
- `write_html()` preserves interaction and is self-contained by default; that embeds Plotly.js and creates a large file. `include_plotlyjs` and `full_html=False` change portability and embedding behavior [PLOTLY-HTML].
|
|
181
|
+
- Static `write_image()` uses Kaleido and supports PNG, JPEG, WebP, SVG, and PDF. Width/height are logical pixels; `scale` changes physical output pixel count, not a journal DPI declaration [PLOTLY-STATIC].
|
|
182
|
+
- WebGL traces are partly rasterized inside SVG/PDF output [PLOTLY-STATIC].
|
|
183
|
+
- Export a static, captioned fallback and accessible data alongside interactive output.
|
|
184
|
+
|
|
185
|
+
## Final scientific review
|
|
186
|
+
|
|
187
|
+
- [ ] Raw data and native images are preserved.
|
|
188
|
+
- [ ] Transformations, exclusions, normalization, bins, and random seeds are recorded.
|
|
189
|
+
- [ ] Missing/censored values are explicit.
|
|
190
|
+
- [ ] Baselines, limits, log scales, and breaks are scientifically justified.
|
|
191
|
+
- [ ] Uncertainty and sample size are defined.
|
|
192
|
+
- [ ] Area/volume and color normalization encode magnitude correctly.
|
|
193
|
+
- [ ] Color is redundant; foreground/background contrast was reviewed.
|
|
194
|
+
- [ ] Alt text/long description and underlying data are available for web delivery.
|
|
195
|
+
- [ ] Physical size, raster pixels, fonts, transparency, and file format were inspected after export.
|
|
196
|
+
- [ ] The current target-journal instructions were checked for the correct submission phase.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Sources and Version Snapshot
|
|
2
|
+
|
|
3
|
+
Research refreshed 2026-07-23 with `parallel-cli search` and `parallel-cli extract`. API and publisher requirements below use current official project, standards-body, publisher, or journal sources only. “Accessed” is 2026-07-23 unless another date is stated.
|
|
4
|
+
|
|
5
|
+
## Tested direct package snapshot
|
|
6
|
+
|
|
7
|
+
- **Matplotlib 3.11.1**, released 2026-07-18; Python >=3.11 [MPL-PYPI].
|
|
8
|
+
- **Seaborn 0.13.2**, released 2024-01-25; Python >=3.8 [SEABORN-PYPI].
|
|
9
|
+
- **Plotly 6.9.0**, released 2026-07-09; Python >=3.8 [PLOTLY-PYPI].
|
|
10
|
+
- **Kaleido 1.3.0**, released 2026-05-04 [KALEIDO-PYPI].
|
|
11
|
+
- **Pillow 12.3.0**, released 2026-07-01; Python >=3.10 [PIL-PYPI].
|
|
12
|
+
- **pypdf 6.14.2**, released 2026-06-23; Python >=3.9 [PYPDF-PYPI].
|
|
13
|
+
|
|
14
|
+
These are pinned direct-dependency snapshots used for smoke tests, not a transitive lock.
|
|
15
|
+
|
|
16
|
+
## Matplotlib
|
|
17
|
+
|
|
18
|
+
- **[MPL-PYPI]** [matplotlib on PyPI](https://pypi.org/project/matplotlib/) — current package version and release history; page dated 2026-07-18.
|
|
19
|
+
- **[MPL-RELEASE]** [Matplotlib release notes](https://matplotlib.org/stable/release/release_notes.html) — 3.11 release/API changes.
|
|
20
|
+
- **[MPL-SAVE]** [`matplotlib.figure.Figure.savefig`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.savefig.html) — 3.11.1 signature; format inference, DPI, metadata, bounding boxes, transparency, backends, Pillow kwargs; built 2026-07-18.
|
|
21
|
+
- **[MPL-BACKENDS]** [Backends](https://matplotlib.org/stable/users/explain/figure/backends.html) — interactive versus static renderers; PDF/PS/SVG/PGF/Cairo formats.
|
|
22
|
+
- **[MPL-STYLE]** [Customizing Matplotlib with style sheets and rcParams](https://matplotlib.org/stable/users/explain/customizing.html) — `rc_context`, style composition, save settings, PDF/PS/SVG font types; built 2026-07-18.
|
|
23
|
+
- **[MPL-LAYOUT]** [Constrained layout guide](https://matplotlib.org/stable/users/explain/axes/constrainedlayout_guide.html) — `layout="constrained"`, colorbars, subfigures, GridSpec, interaction with `tight_layout`.
|
|
24
|
+
- **[MPL-GRIDSPEC]** [`matplotlib.gridspec`](https://matplotlib.org/stable/api/gridspec_api.html) — current grid layout API.
|
|
25
|
+
- **[MPL-NORM]** [Colormap normalization](https://matplotlib.org/stable/users/explain/colors/colormapnorms.html) — `Normalize`, `LogNorm`, `CenteredNorm`, `SymLogNorm`, `PowerNorm`, `BoundaryNorm`, `TwoSlopeNorm`; built 2026-07-18.
|
|
26
|
+
- **[MPL-CMAP]** [Choosing colormaps](https://matplotlib.org/stable/users/explain/colors/colormaps.html) — data classes and perceived lightness.
|
|
27
|
+
|
|
28
|
+
## Seaborn
|
|
29
|
+
|
|
30
|
+
- **[SEABORN-PYPI]** [seaborn on PyPI](https://pypi.org/project/seaborn/) — 0.13.2 package metadata and release history.
|
|
31
|
+
- **[SEABORN-ERROR]** [Statistical estimation and error bars](https://seaborn.pydata.org/tutorial/error_bars.html) — current `errorbar` methods, callable intervals, bootstrapping, `seed`, and `n_boot`.
|
|
32
|
+
- **[SEABORN-FAQ]** [Frequently asked questions](https://seaborn.pydata.org/faq.html) — axes-level versus figure-level functions, Matplotlib object-oriented integration, DPI/SVG notes.
|
|
33
|
+
- **[SEABORN-PALETTE]** [Choosing color palettes](https://seaborn.pydata.org/tutorial/color_palettes.html) — qualitative, sequential, and diverging palette APIs.
|
|
34
|
+
- **[SEABORN-THEME]** [`seaborn.set_theme`](https://seaborn.pydata.org/generated/seaborn.set_theme.html) — style, context, palette, font, scale, and rc parameters.
|
|
35
|
+
|
|
36
|
+
## Plotly and Kaleido
|
|
37
|
+
|
|
38
|
+
- **[PLOTLY-PYPI]** [plotly on PyPI](https://pypi.org/project/plotly/) — 6.9.0 package metadata; released 2026-07-09.
|
|
39
|
+
- **[PLOTLY-STATIC]** [Static image export in Python](https://plotly.com/python/static-image-export/) — Kaleido/Chrome setup, formats, `write_image`, `write_images`, dimensions/scale, WebGL rasterization, offline assets, defaults, EPS/Orca/engine deprecations; page dated 2026.
|
|
40
|
+
- **[PLOTLY-HTML]** [Interactive HTML export](https://plotly.com/python/interactive-html-export/) — `write_html`, `to_html`, `include_plotlyjs`, `full_html`; page dated 2026.
|
|
41
|
+
- **[PLOTLY-CHANGES]** [Static image generation changes in Plotly.py 6.1](https://plotly.com/python/static-image-generation-changes/) — Kaleido v1 migration and deprecations.
|
|
42
|
+
- **[KALEIDO]** [Plotly Kaleido repository](https://github.com/plotly/Kaleido) — Chrome requirement, v1 migration, direct APIs, and offline/page behavior.
|
|
43
|
+
- **[KALEIDO-PYPI]** [kaleido on PyPI](https://pypi.org/project/kaleido/) — 1.3.0 package metadata; released 2026-05-04.
|
|
44
|
+
|
|
45
|
+
## Accessibility and color
|
|
46
|
+
|
|
47
|
+
- **[WCAG22]** [Web Content Accessibility Guidelines (WCAG) 2.2](https://www.w3.org/TR/WCAG22/) — W3C Recommendation; normative SC 1.1.1, 1.4.1, 1.4.3, 1.4.5, and 1.4.11.
|
|
48
|
+
- **[WCAG-NONTEXT]** [Understanding SC 1.4.11: Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) — informative chart/graph examples and testing principles; not itself normative.
|
|
49
|
+
- **[WCAG-COLOR]** [Understanding SC 1.4.1: Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) — informative non-color cue guidance.
|
|
50
|
+
- **[COLORBREWER]** [ColorBrewer 2.0](https://colorbrewer2.org/) — Cynthia Brewer, Mark Harrower, and Penn State; scheme type, data-class count, colorblind/print/photocopy filters, and exports.
|
|
51
|
+
- **[TOL-HOME]** [Paul Tol’s Notes](https://sronpersonalpages.nl/~pault/) — canonical site; page states the move from SRON on 2026-07-07.
|
|
52
|
+
- **[TOL]** [Paul Tol, “Colour Schemes”](https://sronpersonalpages.nl/~pault/data/colourschemes.pdf) — SRON/EPS/TN/09-002, issue 3.2, 2021-08-18; exact sRGB palettes, intended uses, color-vision checks, and grayscale analysis.
|
|
53
|
+
- **[WONG]** [Bang Wong, “Color blindness”](https://www.nature.com/articles/nmeth.1618) — Nature Methods 8, 441 (2011); source commonly used for the eight-color palette.
|
|
54
|
+
|
|
55
|
+
## Publishers and journals
|
|
56
|
+
|
|
57
|
+
All rules were accessed 2026-07-23. Pages without a displayed update date are labeled by access date rather than assigning an invented publication date.
|
|
58
|
+
|
|
59
|
+
- **[NATURE-FINAL]** [`Nature` final submission](https://www.nature.com/nature/for-authors/final-submission) — flagship final files, dimensions, fonts, formats, raster resolution, RGB/CMYK, Extended Data distinctions.
|
|
60
|
+
- **[NATURE-FIG]** [`Nature` research figure specifications](https://research-figure-guide.nature.com/figures/preparing-figures-our-specifications) — graphs, accessibility, RGB, 300/450 dpi discussion, editable Type 42 text, export.
|
|
61
|
+
- **[SCIENCE-INITIAL]** [`Science` initial manuscript instructions](https://www.science.org/content/page/instructions-preparing-initial-manuscript) — initial figure embedding, 300 dpi, widths, fonts, color/contrast, source data.
|
|
62
|
+
- **[SCIENCE-REVISED]** [`Science` revised manuscript instructions](https://www.science.org/content/page/instructions-preparing-revised-manuscript) — separate files, formats, minimum resolution, dimensions, no upsampling.
|
|
63
|
+
- **[CELL-FIG]** [Cell Press figure guidelines](https://www.cell.com/information-for-authors/figure-guidelines) — initial versus final stages, formats, widths, file size, DPI, RGB, fonts, image integrity, AI-assisted image policy.
|
|
64
|
+
- **[PLOS-FIG]** [PLOS Computational Biology figures](https://journals.plos.org/ploscompbiol/s/figures) — provisional-accept waiver, TIFF/EPS, dimensions, 300-600 dpi, RGB/grayscale, file size, image integrity, 2026-04-01 blot/gel requirement.
|
|
65
|
+
- **[ELSEVIER-FORMAT]** [Elsevier artwork formats checklist](https://www.elsevier.com/about/policies-and-standards/author/artwork-and-media-instructions/artwork-formats-checklist) — general formats, RGB preference, separate files, journal override.
|
|
66
|
+
- **[ELSEVIER-SIZE]** [Elsevier artwork sizing](https://www.elsevier.com/about/policies-and-standards/author/artwork-and-media-instructions/artwork-sizing) — general widths, 300/500/1,000 dpi, typography, and explicit journal variability.
|
|
67
|
+
- **[IEEE-SIZE]** [IEEE Resolution and Size](https://journals.ieeeauthorcenter.ieee.org/create-your-ieee-journal-article/create-graphics-for-your-article/resolution-and-size/) — modified 2025-02-25; PS/EPS/PDF, >300/>600 dpi, 88.9/182 mm.
|
|
68
|
+
- **[BMC-BIOINFO]** [BMC Bioinformatics: preparing your manuscript](https://bmcbioinformatics.biomedcentral.com/submission-guidelines/preparing-your-manuscript) — journal-specific formats, 85/170 mm, approximately 300 dpi, 10 MB, embedded fonts.
|
|
69
|
+
- **[ACS-GRAPHICS]** [ACS Preparing Manuscript Graphics](https://pubs.acs.org/page/4authors/submission/graphics_prep.html) — general dimensions and typography; no page update date displayed.
|
|
70
|
+
|
|
71
|
+
## Optional inspection backends
|
|
72
|
+
|
|
73
|
+
- **[PIL-PYPI]** [Pillow on PyPI](https://pypi.org/project/Pillow/) — 12.3.0 package metadata; released 2026-07-01.
|
|
74
|
+
- **[PYPDF-PYPI]** [pypdf on PyPI](https://pypi.org/project/pypdf/) — 6.14.2 package metadata; released 2026-06-23.
|
|
75
|
+
|
|
76
|
+
No Parallel JSON research artifacts are stored in this skill.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Shared, network-free safety helpers for visualization command-line tools."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import stat
|
|
9
|
+
import tempfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
MAX_INPUT_BYTES = 200 * 1024 * 1024
|
|
14
|
+
MAX_REPORT_BYTES = 4 * 1024 * 1024
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CliError(ValueError):
|
|
18
|
+
"""An expected command-line validation error."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def checked_input_file(
|
|
22
|
+
value: str | os.PathLike[str],
|
|
23
|
+
*,
|
|
24
|
+
max_bytes: int = MAX_INPUT_BYTES,
|
|
25
|
+
) -> Path:
|
|
26
|
+
"""Return a bounded regular input file, rejecting symlinks."""
|
|
27
|
+
path = Path(value).expanduser()
|
|
28
|
+
if path.is_symlink():
|
|
29
|
+
raise CliError(f"input must not be a symlink: {path}")
|
|
30
|
+
try:
|
|
31
|
+
info = path.stat()
|
|
32
|
+
except OSError as exc:
|
|
33
|
+
raise CliError(f"cannot access input file {path}: {exc}") from exc
|
|
34
|
+
if not stat.S_ISREG(info.st_mode):
|
|
35
|
+
raise CliError(f"input is not a regular file: {path}")
|
|
36
|
+
if info.st_size > max_bytes:
|
|
37
|
+
raise CliError(
|
|
38
|
+
f"input is {info.st_size} bytes; limit is {max_bytes} bytes"
|
|
39
|
+
)
|
|
40
|
+
return path.resolve()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def checked_output_file(
|
|
44
|
+
value: str | os.PathLike[str],
|
|
45
|
+
*,
|
|
46
|
+
force: bool = False,
|
|
47
|
+
mkdir: bool = False,
|
|
48
|
+
) -> Path:
|
|
49
|
+
"""Validate an explicit output path without following a destination symlink."""
|
|
50
|
+
path = Path(value).expanduser()
|
|
51
|
+
if path.name in {"", ".", ".."}:
|
|
52
|
+
raise CliError("output must name a file")
|
|
53
|
+
if path.is_symlink():
|
|
54
|
+
raise CliError(f"output must not be a symlink: {path}")
|
|
55
|
+
|
|
56
|
+
parent = path.parent
|
|
57
|
+
if mkdir:
|
|
58
|
+
parent.mkdir(parents=True, exist_ok=True)
|
|
59
|
+
if not parent.exists() or not parent.is_dir():
|
|
60
|
+
raise CliError(f"output parent directory does not exist: {parent}")
|
|
61
|
+
if parent.is_symlink():
|
|
62
|
+
raise CliError(f"output parent must not be a symlink: {parent}")
|
|
63
|
+
|
|
64
|
+
if path.exists():
|
|
65
|
+
if not path.is_file():
|
|
66
|
+
raise CliError(f"output exists and is not a regular file: {path}")
|
|
67
|
+
if not force:
|
|
68
|
+
raise CliError(f"refusing to overwrite existing output: {path}")
|
|
69
|
+
return parent.resolve() / path.name
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def atomic_write_bytes(path: Path, payload: bytes, *, force: bool = False) -> None:
|
|
73
|
+
"""Write bytes through a same-directory temporary file."""
|
|
74
|
+
destination = checked_output_file(path, force=force)
|
|
75
|
+
descriptor, temporary_name = tempfile.mkstemp(
|
|
76
|
+
prefix=f".{destination.name}.",
|
|
77
|
+
suffix=".tmp",
|
|
78
|
+
dir=destination.parent,
|
|
79
|
+
)
|
|
80
|
+
temporary = Path(temporary_name)
|
|
81
|
+
try:
|
|
82
|
+
with os.fdopen(descriptor, "wb") as handle:
|
|
83
|
+
handle.write(payload)
|
|
84
|
+
handle.flush()
|
|
85
|
+
os.fsync(handle.fileno())
|
|
86
|
+
os.chmod(temporary, 0o600)
|
|
87
|
+
if destination.exists() and not force:
|
|
88
|
+
raise CliError(f"refusing to overwrite existing output: {destination}")
|
|
89
|
+
os.replace(temporary, destination)
|
|
90
|
+
finally:
|
|
91
|
+
try:
|
|
92
|
+
temporary.unlink()
|
|
93
|
+
except FileNotFoundError:
|
|
94
|
+
pass
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def emit_json(
|
|
98
|
+
document: dict[str, Any],
|
|
99
|
+
*,
|
|
100
|
+
output: str | os.PathLike[str] | None = None,
|
|
101
|
+
force: bool = False,
|
|
102
|
+
) -> None:
|
|
103
|
+
"""Print deterministic JSON or write it safely to an explicit file."""
|
|
104
|
+
payload = (
|
|
105
|
+
json.dumps(document, indent=2, sort_keys=True, ensure_ascii=False) + "\n"
|
|
106
|
+
).encode("utf-8")
|
|
107
|
+
if len(payload) > MAX_REPORT_BYTES:
|
|
108
|
+
raise CliError(
|
|
109
|
+
f"report is {len(payload)} bytes; limit is {MAX_REPORT_BYTES} bytes"
|
|
110
|
+
)
|
|
111
|
+
if output is None:
|
|
112
|
+
print(payload.decode("utf-8"), end="")
|
|
113
|
+
return
|
|
114
|
+
atomic_write_bytes(Path(output), payload, force=force)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def positive_int(value: str) -> int:
|
|
118
|
+
"""Argparse converter for strictly positive integers."""
|
|
119
|
+
try:
|
|
120
|
+
parsed = int(value)
|
|
121
|
+
except ValueError as exc:
|
|
122
|
+
raise CliError(f"expected an integer, got {value!r}") from exc
|
|
123
|
+
if parsed <= 0:
|
|
124
|
+
raise CliError("value must be greater than zero")
|
|
125
|
+
return parsed
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def positive_float(value: str) -> float:
|
|
129
|
+
"""Argparse converter for finite, strictly positive floats."""
|
|
130
|
+
try:
|
|
131
|
+
parsed = float(value)
|
|
132
|
+
except ValueError as exc:
|
|
133
|
+
raise CliError(f"expected a number, got {value!r}") from exc
|
|
134
|
+
if not (parsed > 0 and parsed < float("inf")):
|
|
135
|
+
raise CliError("value must be finite and greater than zero")
|
|
136
|
+
return parsed
|