@brainpilot/skills 0.0.6

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.
Files changed (229) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +28 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +35 -0
  6. package/skills/01_Meta-Skills/contribute-skill/SKILL.md +277 -0
  7. package/skills/01_Meta-Skills/contribute-skills-via-pr/SKILL.md +163 -0
  8. package/skills/01_Meta-Skills/paper-to-skill/SKILL.md +435 -0
  9. package/skills/01_Meta-Skills/paper-to-skill/references/extraction-guide.md +286 -0
  10. package/skills/01_Meta-Skills/paper-to-skill/references/skill-template.md +250 -0
  11. package/skills/01_Meta-Skills/repo-to-skill/SKILL.md +289 -0
  12. package/skills/01_Meta-Skills/share-case/SKILL.md +253 -0
  13. package/skills/01_Meta-Skills/share-usage/README.md +63 -0
  14. package/skills/01_Meta-Skills/share-usage/SKILL.md +395 -0
  15. package/skills/01_Meta-Skills/verify-skill/SKILL.md +331 -0
  16. package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/SKILL.md +194 -0
  17. package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/references/effect-sizes.md +352 -0
  18. package/skills/02_Cross-Domain_Foundation/cogsci-power-analysis/references/sample-size-guide.md +407 -0
  19. package/skills/02_Cross-Domain_Foundation/cogsci-statistics/SKILL.md +361 -0
  20. package/skills/02_Cross-Domain_Foundation/cogsci-statistics/references/common-analyses.md +517 -0
  21. package/skills/02_Cross-Domain_Foundation/cogsci-visualization/SKILL.md +292 -0
  22. package/skills/02_Cross-Domain_Foundation/cogsci-visualization/references/plot-recipes.md +709 -0
  23. package/skills/02_Cross-Domain_Foundation/research-literacy/SKILL.md +286 -0
  24. package/skills/02_Cross-Domain_Foundation/research-literacy/references/common-assumptions.md +320 -0
  25. package/skills/02_Cross-Domain_Foundation/research-literacy/references/planning-template.md +143 -0
  26. package/skills/03_Cognitive_Psychology/alternative-uses-task-designer/SKILL.md +197 -0
  27. package/skills/03_Cognitive_Psychology/alternative-uses-task-designer/references/instruction-templates.md +60 -0
  28. package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/SKILL.md +246 -0
  29. package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/references/classic-paradigms.md +435 -0
  30. package/skills/03_Cognitive_Psychology/cognitive-paradigm-design/references/design-principles.md +256 -0
  31. package/skills/03_Cognitive_Psychology/creativity-self-efficacy-mediation/SKILL.md +270 -0
  32. package/skills/03_Cognitive_Psychology/creativity-self-efficacy-mediation/references/lavaan-templates.md +172 -0
  33. package/skills/03_Cognitive_Psychology/divergent-thinking-scoring/SKILL.md +238 -0
  34. package/skills/03_Cognitive_Psychology/divergent-thinking-scoring/references/scoring-rubric.md +143 -0
  35. package/skills/03_Cognitive_Psychology/drift-diffusion-model/SKILL.md +203 -0
  36. package/skills/03_Cognitive_Psychology/drift-diffusion-model/references/fitting-guide.md +571 -0
  37. package/skills/03_Cognitive_Psychology/drift-diffusion-model/references/model-variants.md +427 -0
  38. package/skills/03_Cognitive_Psychology/evidence-accumulation-selector/SKILL.md +310 -0
  39. package/skills/03_Cognitive_Psychology/evidence-accumulation-selector/references/ez-diffusion-formulas.md +137 -0
  40. package/skills/03_Cognitive_Psychology/signal-detection-analysis/SKILL.md +300 -0
  41. package/skills/03_Cognitive_Psychology/signal-detection-analysis/references/application-guide.md +278 -0
  42. package/skills/03_Cognitive_Psychology/signal-detection-analysis/references/sdt-formulas.md +318 -0
  43. package/skills/03_Cognitive_Psychology/visual-search-array-generator/SKILL.md +283 -0
  44. package/skills/03_Cognitive_Psychology/visual-search-array-generator/references/array-generation-parameters.yaml +111 -0
  45. package/skills/04_Psycholinguistics/reading-time-analysis/SKILL.md +301 -0
  46. package/skills/04_Psycholinguistics/reading-time-analysis/references/measure-computation-guide.md +195 -0
  47. package/skills/04_Psycholinguistics/self-paced-reading-designer/SKILL.md +257 -0
  48. package/skills/04_Psycholinguistics/self-paced-reading-designer/references/analysis-guide.md +356 -0
  49. package/skills/04_Psycholinguistics/self-paced-reading-designer/references/region-segmentation.md +266 -0
  50. package/skills/04_Psycholinguistics/sentence-stimulus-norming/SKILL.md +346 -0
  51. package/skills/04_Psycholinguistics/sentence-stimulus-norming/references/lexical-databases-guide.md +184 -0
  52. package/skills/05_EEG_ERP/eeg-paradigm-designer/SKILL.md +226 -0
  53. package/skills/05_EEG_ERP/eeg-paradigm-designer/references/component-paradigm-map.md +276 -0
  54. package/skills/05_EEG_ERP/eeg-paradigm-designer/references/timing-parameters.md +244 -0
  55. package/skills/05_EEG_ERP/eeg-preprocessing-pipeline-guide/SKILL.md +367 -0
  56. package/skills/05_EEG_ERP/eeg-preprocessing-pipeline-guide/references/parameter-lookup-tables.md +138 -0
  57. package/skills/05_EEG_ERP/erp-analysis/SKILL.md +185 -0
  58. package/skills/05_EEG_ERP/erp-analysis/references/erp-components.md +447 -0
  59. package/skills/05_EEG_ERP/erp-analysis/references/preprocessing-pipeline.md +277 -0
  60. package/skills/05_EEG_ERP/erp-analysis/references/statistical-approaches.md +351 -0
  61. package/skills/05_EEG_ERP/mne-python-guide/SKILL.md +174 -0
  62. package/skills/05_EEG_ERP/mne-python-guide/references/decoding.md +178 -0
  63. package/skills/05_EEG_ERP/mne-python-guide/references/io_formats.md +160 -0
  64. package/skills/05_EEG_ERP/mne-python-guide/references/preprocessing.md +259 -0
  65. package/skills/05_EEG_ERP/mne-python-guide/references/simulation.md +173 -0
  66. package/skills/05_EEG_ERP/mne-python-guide/references/source_localization.md +234 -0
  67. package/skills/05_EEG_ERP/mne-python-guide/references/statistics.md +196 -0
  68. package/skills/05_EEG_ERP/mne-python-guide/references/time_frequency.md +165 -0
  69. package/skills/05_EEG_ERP/mne-python-guide/references/visualization.md +175 -0
  70. package/skills/06_fMRI_Neuroimaging/brain-connectivity-modeler/SKILL.md +317 -0
  71. package/skills/06_fMRI_Neuroimaging/brain-connectivity-modeler/references/method-implementation-guide.md +116 -0
  72. package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/SKILL.md +296 -0
  73. package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/references/design-matrix-guide.md +214 -0
  74. package/skills/06_fMRI_Neuroimaging/fmri-glm-analysis-guide/references/statistical-inference.md +288 -0
  75. package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/SKILL.md +274 -0
  76. package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/references/quality-control.md +336 -0
  77. package/skills/06_fMRI_Neuroimaging/fmri-preprocessing-pipeline-guide/references/step-by-step-pipeline.md +380 -0
  78. package/skills/06_fMRI_Neuroimaging/fmri-task-design-guide/SKILL.md +264 -0
  79. package/skills/06_fMRI_Neuroimaging/fmri-task-design-guide/references/design-optimization-examples.md +114 -0
  80. package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/SKILL.md +273 -0
  81. package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/references/decoding-methods.md +170 -0
  82. package/skills/06_fMRI_Neuroimaging/neural-decoding-analysis/references/rsa-guide.md +266 -0
  83. package/skills/06_fMRI_Neuroimaging/pycortex-guide/SKILL.md +123 -0
  84. package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/database-subjects.md +179 -0
  85. package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/dataset-types.md +208 -0
  86. package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/freesurfer-fmriprep.md +162 -0
  87. package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/mapping-transforms.md +181 -0
  88. package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/mni-utils.md +207 -0
  89. package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/surface-analysis.md +219 -0
  90. package/skills/06_fMRI_Neuroimaging/pycortex-guide/references/visualization.md +251 -0
  91. package/skills/07_Computational_Modeling/act-r-model-builder/SKILL.md +297 -0
  92. package/skills/07_Computational_Modeling/act-r-model-builder/references/model-patterns.md +197 -0
  93. package/skills/07_Computational_Modeling/act-r-model-builder/references/parameter-table.yaml +204 -0
  94. package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/SKILL.md +294 -0
  95. package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/references/diagnostics-checklist.md +351 -0
  96. package/skills/07_Computational_Modeling/bayesian-cognitive-model-builder/references/prior-selection-guide.md +241 -0
  97. package/skills/07_Computational_Modeling/parameter-recovery-checker/SKILL.md +269 -0
  98. package/skills/07_Computational_Modeling/parameter-recovery-checker/references/recovery-diagnostics.md +207 -0
  99. package/skills/08_Computational_Neuroscience/brain-connectivity-modeler/SKILL.md +317 -0
  100. package/skills/08_Computational_Neuroscience/brain-connectivity-modeler/references/method-implementation-guide.md +116 -0
  101. package/skills/08_Computational_Neuroscience/neural-decoding-analysis/SKILL.md +273 -0
  102. package/skills/08_Computational_Neuroscience/neural-decoding-analysis/references/decoding-methods.md +170 -0
  103. package/skills/08_Computational_Neuroscience/neural-decoding-analysis/references/rsa-guide.md +266 -0
  104. package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/SKILL.md +305 -0
  105. package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/references/data-requirements.md +60 -0
  106. package/skills/08_Computational_Neuroscience/neural-population-analysis-guide/references/method-comparison.md +151 -0
  107. package/skills/08_Computational_Neuroscience/spiking-network-model-builder/SKILL.md +376 -0
  108. package/skills/08_Computational_Neuroscience/spiking-network-model-builder/references/hh-parameters.md +117 -0
  109. package/skills/08_Computational_Neuroscience/spiking-network-model-builder/references/network-regimes.md +130 -0
  110. package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/SKILL.md +258 -0
  111. package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/references/indicator-parameters.md +242 -0
  112. package/skills/09_Cellular_Molecular_Neuroscience/calcium-imaging-analysis-guide/references/pipeline-details.md +211 -0
  113. package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/SKILL.md +261 -0
  114. package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/references/opsin-catalog.md +124 -0
  115. package/skills/09_Cellular_Molecular_Neuroscience/optogenetics-protocol-designer/references/stimulation-parameters.md +304 -0
  116. package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/SKILL.md +367 -0
  117. package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/references/disconnection-guide.md +152 -0
  118. package/skills/10_Clinical_Neuropsychology/lesion-symptom-mapping-guide/references/vlsm-pipeline.md +182 -0
  119. package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/SKILL.md +250 -0
  120. package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/references/deficit-profiles.md +302 -0
  121. package/skills/10_Clinical_Neuropsychology/neuropsych-battery-selector/references/test-catalog.md +304 -0
  122. package/skills/11_Developmental_Cognition/infant-looking-time-designer/SKILL.md +345 -0
  123. package/skills/11_Developmental_Cognition/infant-looking-time-designer/references/age-parameters.yaml +186 -0
  124. package/skills/12_Social_Cognition/tom-task-selector/SKILL.md +379 -0
  125. package/skills/12_Social_Cognition/tom-task-selector/references/task-database.md +317 -0
  126. package/skills/13_Visualization/nature-figure/README.md +442 -0
  127. package/skills/13_Visualization/nature-figure/SKILL.md +60 -0
  128. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-01-bar-charts.png +0 -0
  129. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-02-line-trends.png +0 -0
  130. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-03-heatmaps.png +0 -0
  131. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-04-scatter-bubble.png +0 -0
  132. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-05-radar-polar.png +0 -0
  133. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-06-distributions.png +0 -0
  134. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-07-forest-interval.png +0 -0
  135. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-08-area-stacked.png +0 -0
  136. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-09-image-plates.png +0 -0
  137. package/skills/13_Visualization/nature-figure/assets/chart-atlas/atlas-10-network-matrix.png +0 -0
  138. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_motivation.png +0 -0
  139. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_observation.png +0 -0
  140. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/Dispersion_observation_distillation.png +0 -0
  141. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_contrastive.png +0 -0
  142. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_results_CEDAR.png +0 -0
  143. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_results_IEDB.png +0 -0
  144. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/ImmunoStruct_schematic.png +0 -0
  145. package/skills/13_Visualization/nature-figure/assets/figures4papers/assets/RNAGenScape_schematic.png +0 -0
  146. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/figures/ablation.png +0 -0
  147. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/figures/comparison.png +0 -0
  148. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/plot_ablation.py +86 -0
  149. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_CellSpliceNet/plot_comparison.py +109 -0
  150. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/diffusion_swiss_roll.py +97 -0
  151. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/diffusion_swiss_roll.png +0 -0
  152. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.pdf +0 -0
  153. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.png +0 -0
  154. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.pdf +0 -0
  155. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.png +0 -0
  156. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.pdf +0 -0
  157. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.png +0 -0
  158. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_Ablation.py +64 -0
  159. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_GeneRegulatory.py +74 -0
  160. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Cflows/plot_comparison_Trajectory.py +74 -0
  161. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/figures/idea.png +0 -0
  162. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/figures/illustration.png +0 -0
  163. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/plot_idea.py +76 -0
  164. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_Dispersion/plot_illustration.py +404 -0
  165. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_FPGM/figures/freq_prior.png +0 -0
  166. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_FPGM/plot_freq_prior.py +146 -0
  167. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_ablation_Cancer.png +0 -0
  168. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_ablation_IEDB.png +0 -0
  169. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_comparison_Cancer.png +0 -0
  170. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/figures/bars_comparison_IEDB.png +0 -0
  171. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/plot_bars.py +216 -0
  172. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ImmunoStruct/raw_data.py +125 -0
  173. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/manifold.png +0 -0
  174. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/manifold_holes.png +0 -0
  175. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_comparison_optimization.png +0 -0
  176. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_comparison_speed.png +0 -0
  177. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/figures/results_sweep.png +0 -0
  178. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_comparison.py +228 -0
  179. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_hole_manifold.py +82 -0
  180. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_manifold.py +61 -0
  181. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_RNAGenScape/plot_sweep.py +77 -0
  182. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/figures/comparison_posttraining.png +0 -0
  183. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/figures/comparison_radar.png +0 -0
  184. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/plot_comparison_radar.py +173 -0
  185. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_VIGIL/plot_posttraining.py +82 -0
  186. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/brute_force.png +0 -0
  187. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/correctness_by_category.png +0 -0
  188. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/correctness_by_subcategory.png +0 -0
  189. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/rewriting.png +0 -0
  190. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/figures/selfcorrection_math.png +0 -0
  191. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_brute_force.py +248 -0
  192. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_correctness_by_category.py +132 -0
  193. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_correctness_by_subcategory.py +131 -0
  194. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_rewriting.py +105 -0
  195. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_brainteaser/plot_selfcorrection_math.py +99 -0
  196. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/figures/composition_heatmap.png +0 -0
  197. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/figures/trend_by_month.png +0 -0
  198. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/plot_composition.py +81 -0
  199. package/skills/13_Visualization/nature-figure/assets/figures4papers/figure_ophthal_review/plot_trend.py +125 -0
  200. package/skills/13_Visualization/nature-figure/assets/gallery/fig1-material-mechanism-rich.png +0 -0
  201. package/skills/13_Visualization/nature-figure/assets/gallery/fig2-spatial-imaging-rich.png +0 -0
  202. package/skills/13_Visualization/nature-figure/assets/gallery/fig3-in-vivo-efficacy-rich.png +0 -0
  203. package/skills/13_Visualization/nature-figure/assets/gallery/fig4-single-cell-systems-rich.png +0 -0
  204. package/skills/13_Visualization/nature-figure/assets/gallery/fig5-validation-perturbation-rich.png +0 -0
  205. package/skills/13_Visualization/nature-figure/evals/evals.json +37 -0
  206. package/skills/13_Visualization/nature-figure/manifest.yaml +57 -0
  207. package/skills/13_Visualization/nature-figure/references/api.md +428 -0
  208. package/skills/13_Visualization/nature-figure/references/backend-selection.md +100 -0
  209. package/skills/13_Visualization/nature-figure/references/chart-types.md +281 -0
  210. package/skills/13_Visualization/nature-figure/references/common-patterns.md +350 -0
  211. package/skills/13_Visualization/nature-figure/references/demos.md +65 -0
  212. package/skills/13_Visualization/nature-figure/references/design-theory.md +436 -0
  213. package/skills/13_Visualization/nature-figure/references/figure-contract.md +93 -0
  214. package/skills/13_Visualization/nature-figure/references/nature-2026-observations.md +112 -0
  215. package/skills/13_Visualization/nature-figure/references/qa-contract.md +119 -0
  216. package/skills/13_Visualization/nature-figure/references/r-template-index.md +66 -0
  217. package/skills/13_Visualization/nature-figure/references/r-workflow.md +161 -0
  218. package/skills/13_Visualization/nature-figure/references/tutorials.md +251 -0
  219. package/skills/13_Visualization/nature-figure/static/core/contract.md +29 -0
  220. package/skills/13_Visualization/nature-figure/static/core/stance.md +37 -0
  221. package/skills/13_Visualization/nature-figure/static/fragments/backend/python.md +37 -0
  222. package/skills/13_Visualization/nature-figure/static/fragments/backend/r.md +44 -0
  223. package/skills/14_Writing/markdown-report-writing/SKILL.md +306 -0
  224. package/skills/14_Writing/markdown-report-writing/references/compatibility-matrix.md +72 -0
  225. package/skills/14_Writing/markdown-report-writing/references/templates.md +299 -0
  226. package/skills/15_Others/neuroimaging-power-guide/SKILL.md +324 -0
  227. package/skills/15_Others/neuroimaging-power-guide/references/effect-size-lookup-tables.md +102 -0
  228. package/skills/15_Others/neuroimaging-sample-size-calculator/SKILL.md +330 -0
  229. package/skills/15_Others/neuroimaging-sample-size-calculator/references/worked-examples.md +220 -0
@@ -0,0 +1,119 @@
1
+ # QA Contract
2
+
3
+ Use this before final delivery, before a revision package, and whenever the figure
4
+ contains microscopy, blots, gels, clinical subgroup analysis, or statistical claims.
5
+ Journal rules change, so verify the latest target journal author guide for final
6
+ submission. The values below are conservative defaults for Nature-family style work.
7
+
8
+ ## Current official references to verify
9
+
10
+ - Nature research figure guide: `https://research-figure-guide.nature.com/`
11
+ - Nature building/exporting panels: `https://research-figure-guide.nature.com/figures/building-and-exporting-figure-panels/`
12
+ - Nature preparing figures/specifications: `https://research-figure-guide.nature.com/figures/preparing-figures-our-specifications/`
13
+ - Nature initial submission and statistics guidance: `https://www.nature.com/nature/for-authors/initial-submission`
14
+ - Nature formatting guide: `https://www.nature.com/nature/for-authors/formatting-guide`
15
+ - Journal of Cell Biology figure/video guidelines for microscopy-oriented image QA: `https://rupress.org/jcb/pages/fig-vid-guidelines`
16
+ - Elsevier/Cell-family image-manipulation baseline: `https://www.sciencedirect.com/journal/the-cell-surface/publish/guide-for-authors`
17
+
18
+ ## Pre-submission checklist
19
+
20
+ | Check | Pass condition |
21
+ |---|---|
22
+ | Core conclusion | One-sentence claim exists and every panel maps to it |
23
+ | Archetype | Figure has a declared archetype and panel hierarchy |
24
+ | Backend exclusivity | The selected backend produced all plotting, previews, exports, and visual QA renders |
25
+ | Final size | Single-column about 89 mm or double-column about 183 mm, height not above target journal limit |
26
+ | Text size | Body/tick/legend text is readable at final size, usually 5-7 pt for dense journal figures |
27
+ | Panel labels | Lowercase, bold, near top-left, typically 8 pt at final size |
28
+ | Editable text | SVG/PDF text remains editable; no outlined text unless unavoidable for special symbols |
29
+ | Font | Arial/Helvetica/sans-serif fallback is used consistently |
30
+ | Color | No rainbow color maps; red/green is not the only encoding; grayscale print remains interpretable |
31
+ | Legend strategy | Shared or direct labels where possible; no repeated redundant legends |
32
+ | Statistics | `n`, biological/technical repeat definition, center, spread, test, correction, and exact comparison are documented |
33
+ | Source data | Quantitative panels can be traced to a clean CSV/TSV/XLSX or script output |
34
+ | Raster resolution | Photos/microscopy are high-resolution enough for final size; line art uses vector where possible |
35
+ | Microscopy scale | Scale bar is present, calibrated, and not only a magnification factor |
36
+ | Image integrity | Crop, contrast, pseudo-color, stitching, reuse, and raw-file provenance are recorded |
37
+ | Export bundle | Script, source data, SVG, PDF, TIFF/PNG preview, and QA notes are delivered together when requested |
38
+
39
+ ## Statistics legend minimum
40
+
41
+ For each quantitative panel, capture:
42
+
43
+ ```text
44
+ n definition:
45
+ biological replicates:
46
+ technical replicates:
47
+ center statistic:
48
+ spread/interval:
49
+ test:
50
+ multiple-comparison correction:
51
+ p-value display:
52
+ source-data file:
53
+ ```
54
+
55
+ For machine-learning/model figures, also capture:
56
+
57
+ ```text
58
+ train/validation/test split:
59
+ number of seeds or folds:
60
+ metric definition:
61
+ confidence interval or variability definition:
62
+ baseline definition:
63
+ ```
64
+
65
+ ## Image-integrity minimum
66
+
67
+ For each image panel, capture:
68
+
69
+ ```text
70
+ raw file:
71
+ processed file:
72
+ crop:
73
+ brightness/contrast/gamma:
74
+ pseudo-color:
75
+ scale calibration:
76
+ stitching:
77
+ reuse in other figures:
78
+ quantification link:
79
+ ```
80
+
81
+ Global adjustments are generally safer than local selective edits. If an adjustment
82
+ changes the visibility of relevant background or bands, flag it instead of silently
83
+ normalizing it away.
84
+
85
+ ## Export checks
86
+
87
+ Run only the export block for the selected backend. If that backend is unavailable,
88
+ stop and report the missing runtime/package instead of producing a substitute export
89
+ with the other language.
90
+
91
+ ### Python
92
+
93
+ ```python
94
+ import matplotlib as mpl
95
+ mpl.rcParams["svg.fonttype"] = "none"
96
+ mpl.rcParams["pdf.fonttype"] = 42
97
+ fig.savefig("figure.svg", bbox_inches="tight")
98
+ fig.savefig("figure.pdf", bbox_inches="tight")
99
+ fig.savefig("figure.tiff", dpi=600, bbox_inches="tight")
100
+ ```
101
+
102
+ ### R
103
+
104
+ ```r
105
+ svglite::svglite("figure.svg", width = width_mm / 25.4, height = height_mm / 25.4)
106
+ print(plot)
107
+ dev.off()
108
+
109
+ grDevices::cairo_pdf("figure.pdf", width = width_mm / 25.4, height = height_mm / 25.4, family = "Arial")
110
+ print(plot)
111
+ dev.off()
112
+
113
+ ragg::agg_tiff("figure.tiff", width = width_mm / 25.4, height = height_mm / 25.4, units = "in", res = 600)
114
+ print(plot)
115
+ dev.off()
116
+ ```
117
+
118
+ Open the SVG/PDF after export and verify that text can be selected, labels do not
119
+ overlap, and the figure still reads at final printed size.
@@ -0,0 +1,66 @@
1
+ # Private R Template Adaptation
2
+
3
+ Use this reference when the user chooses R and provides or mentions an existing
4
+ R plotting template collection. Treat such material as private working context.
5
+ Do not reveal absolute paths, folder names, filenames, screenshots, provenance, or
6
+ any identifying labels from the source collection in user-facing output.
7
+
8
+ ## Privacy rules
9
+
10
+ - Never include absolute local paths in generated code, reports, comments, or final replies.
11
+ - Never mention the original source file, folder, template number, course title, download
12
+ location, chat attachment, or private document name.
13
+ - When a template is useful, describe it generically by chart family: "a grouped bar
14
+ template", "a ComplexHeatmap workflow", "a survival plotting workflow".
15
+ - If a reusable idea is copied from a private template, rewrite the final code as a clean,
16
+ self-contained script with neutral function names and neutral comments.
17
+ - If the user asks where a style came from, say it was adapted from the provided working
18
+ materials without identifying the path or source file.
19
+
20
+ ## Generic search strategy
21
+
22
+ Search private materials by chart family and package names, not by exposing paths:
23
+
24
+ ```bash
25
+ find <private-template-root> -type f \( -name '*.R' -o -name '*.Rmd' -o -name '*.r' \)
26
+ rg -n "ggplot|patchwork|ComplexHeatmap|ggrepel|svglite|cairo_pdf|survminer|circlize" <private-template-root>
27
+ ```
28
+
29
+ Keep these commands in internal working notes only. Do not paste the user's private
30
+ root path into the final answer.
31
+
32
+ ## Chart-family map
33
+
34
+ Use these generic families to decide what to inspect:
35
+
36
+ | Need | Search targets |
37
+ |---|---|
38
+ | Bars and grouped comparisons | `geom_col`, `geom_bar`, `position_dodge`, `stat_compare_means` |
39
+ | Error bars and point-interval plots | `geom_errorbar`, `geom_pointrange`, `mean_se`, `stat_summary` |
40
+ | Stacked or bidirectional bars | `position_stack`, `coord_flip`, signed values, paired positive/negative bars |
41
+ | Box, violin, paired, and raincloud-style distributions | `geom_boxplot`, `geom_violin`, `geom_jitter`, paired sample identifiers |
42
+ | Heatmaps and annotated heatmaps | `ComplexHeatmap`, `HeatmapAnnotation`, `pheatmap`, `geom_tile` |
43
+ | Correlation, scatter, bubble, and volcano plots | `geom_point`, `geom_smooth`, `ggrepel`, `logFC`, `pvalue`, bubble size scales |
44
+ | PCA, PCoA, NMDS, tSNE, UMAP | `prcomp`, `cmdscale`, `vegan`, `Rtsne`, `Seurat`, embedding coordinates |
45
+ | Survival, Cox, subgroup, ROC, forest | `survival`, `survminer`, `coxph`, `forestplot`, `timeROC`, hazard ratios |
46
+ | Enrichment and pathway summaries | `clusterProfiler`, `GSEA`, `enrichGO`, `enrichKEGG`, dot plots, ridge plots |
47
+ | Circular, genome, phylogeny, chromosome | `circlize`, `ggtree`, `karyoploteR`, genome interval tracks |
48
+ | Single-cell and omics workflows | `Seurat`, marker genes, differential expression, cell-type annotation |
49
+ | Maps, anatomy, and spatial summaries | `sf`, `maps`, `gganatogram`, spatial coordinates |
50
+ | Radar, lollipop, dumbbell, UpSet, Venn, Sankey | `ggradar`, `geom_segment`, `UpSetR`, `ggalluvial`, set operations |
51
+
52
+ ## Adaptation checklist
53
+
54
+ When adapting a private template:
55
+
56
+ - Keep useful data wrangling, statistics, and geoms.
57
+ - Replace template-specific colors with the figure-level semantic palette.
58
+ - Normalize fonts to final-size 5-7 pt text and 8 pt bold lowercase panel labels.
59
+ - Convert single-output PNG/PDF scripts to SVG/PDF/TIFF export.
60
+ - Remove decorative elements that do not support the core conclusion.
61
+ - Ensure each statistical comparison has `n`, center, spread, test, and correction
62
+ information in the legend or source-data notes.
63
+ - For image panels, document raw file, crop, contrast, scale-bar calibration, and any
64
+ stitching or pseudo-coloring in private QA notes.
65
+ - Final code should be self-contained and should not require the original private
66
+ folder structure unless the user explicitly asks to keep that workflow.
@@ -0,0 +1,161 @@
1
+ # R Workflow
2
+
3
+ Use this when the user chooses R, brings R data/scripts, or asks to reuse the local
4
+ R plotting templates. The R track should still follow the same figure contract:
5
+ claim first, evidence hierarchy second, plotting code third.
6
+
7
+ ## R-only execution rule
8
+
9
+ When the user has selected R, do all figure drawing, previewing, exporting, and
10
+ visual QA in R. Do not call Python/matplotlib/seaborn/plotly to create a temporary
11
+ preview, fallback export, or layout approximation. If R, `Rscript`, or required R
12
+ packages are missing, stop before rendering and report the missing dependency. You
13
+ may still write the R script, provide `install.packages()` commands, or ask permission
14
+ to install dependencies, but do not cross-render the figure in another language.
15
+
16
+ Allowed non-R utilities are limited to non-visual tasks such as shell file inspection,
17
+ CSV line counts, checksums, archive extraction, or text search. They must not create
18
+ image/vector outputs or alter visual layout.
19
+
20
+ ## Required packages by task
21
+
22
+ | Task | Preferred packages |
23
+ |---|---|
24
+ | Bars, boxplots, violins, dot plots, lines, volcano plots | `ggplot2`, `ggrepel`, `dplyr`, `tidyr` |
25
+ | Multi-panel assembly | `patchwork`; use `cowplot` only when inset alignment requires it |
26
+ | Rich omics heatmaps | `ComplexHeatmap`, `circlize`, `grid` |
27
+ | Survival and clinical subgroup plots | `survival`, `survminer`, `forestplot`, `ggplot2` |
28
+ | Circular/genome plots | `circlize`, `ggtree`, `gggenes`, domain-specific packages |
29
+ | Export | `svglite`, `grDevices::cairo_pdf`, `ragg` |
30
+
31
+ ## Contract scaffold
32
+
33
+ ```r
34
+ library(ggplot2)
35
+ library(patchwork)
36
+
37
+ palette_contract <- c(
38
+ neutral_dark = "#272727",
39
+ neutral_mid = "#767676",
40
+ neutral_light = "#D8D8D8",
41
+ signal_blue = "#3182BD",
42
+ signal_teal = "#33B5A5",
43
+ accent_red = "#D24B40",
44
+ accent_orange = "#E28E2C"
45
+ )
46
+
47
+ theme_nature_contract <- function(base_size = 6.5, base_family = "Arial") {
48
+ theme_classic(base_size = base_size, base_family = base_family) +
49
+ theme(
50
+ axis.line = element_line(linewidth = 0.35, colour = "black"),
51
+ axis.ticks = element_line(linewidth = 0.35, colour = "black"),
52
+ axis.title = element_text(size = base_size),
53
+ axis.text = element_text(size = base_size - 0.5),
54
+ legend.title = element_text(size = base_size - 0.3),
55
+ legend.text = element_text(size = base_size - 0.7),
56
+ strip.text = element_text(size = base_size - 0.3, face = "bold"),
57
+ plot.title = element_text(size = base_size + 0.5, face = "bold"),
58
+ panel.grid = element_blank()
59
+ )
60
+ }
61
+
62
+ theme_set(theme_nature_contract())
63
+
64
+ save_pub_r <- function(plot, filename, width_mm = 183, height_mm = 120, dpi = 600) {
65
+ w <- width_mm / 25.4
66
+ h <- height_mm / 25.4
67
+
68
+ svglite::svglite(paste0(filename, ".svg"), width = w, height = h)
69
+ print(plot)
70
+ dev.off()
71
+
72
+ grDevices::cairo_pdf(paste0(filename, ".pdf"), width = w, height = h, family = "Arial")
73
+ print(plot)
74
+ dev.off()
75
+
76
+ ragg::agg_tiff(paste0(filename, ".tiff"), width = w, height = h, units = "in", res = dpi)
77
+ print(plot)
78
+ dev.off()
79
+ }
80
+ ```
81
+
82
+ ## Panel labels in R
83
+
84
+ Use patchwork tags for most multi-panel figures:
85
+
86
+ ```r
87
+ fig <- (p_a | p_b) / (p_c | p_d) +
88
+ plot_annotation(tag_levels = "a") &
89
+ theme(plot.tag = element_text(size = 8, face = "bold"))
90
+ ```
91
+
92
+ Use manual labels only when dark image plates or inset geometry make patchwork tags
93
+ misalign.
94
+
95
+ ## Patchwork layout patterns
96
+
97
+ ### Quantitative grid
98
+
99
+ ```r
100
+ fig <- (p_a | p_b | guide_area()) /
101
+ (p_c | p_d | p_e) +
102
+ plot_layout(guides = "collect", widths = c(1, 1, 0.45)) &
103
+ theme(legend.position = "right")
104
+ ```
105
+
106
+ ### Schematic-led composite
107
+
108
+ ```r
109
+ design <- "
110
+ AAAA
111
+ BBCD
112
+ "
113
+ fig <- p_schematic + p_b + p_c + p_d +
114
+ plot_layout(design = design, heights = c(1.8, 1))
115
+ ```
116
+
117
+ ### Image plate plus quant
118
+
119
+ Keep black backgrounds inside image panels only. Put scale bars on the image, then
120
+ place quantification next to or below the representative image.
121
+
122
+ ```r
123
+ p_img <- ggplot(img_df, aes(x, y, fill = intensity)) +
124
+ geom_raster() +
125
+ scale_fill_gradient(low = "black", high = "white") +
126
+ coord_fixed(expand = FALSE) +
127
+ annotate("segment", x = 10, xend = 40, y = 10, yend = 10,
128
+ linewidth = 0.6, colour = "white") +
129
+ theme_void() +
130
+ theme(legend.position = "none", plot.background = element_rect(fill = "black", colour = NA))
131
+ ```
132
+
133
+ ## ComplexHeatmap export
134
+
135
+ `ComplexHeatmap` objects are grid objects, not ggplot objects. Export them by opening
136
+ the graphics device, drawing, then closing it.
137
+
138
+ ```r
139
+ library(ComplexHeatmap)
140
+ library(circlize)
141
+
142
+ pdf("heatmap.pdf", width = 7.2, height = 4.8, family = "Arial")
143
+ draw(ht, heatmap_legend_side = "right", annotation_legend_side = "right")
144
+ dev.off()
145
+
146
+ svglite::svglite("heatmap.svg", width = 7.2, height = 4.8)
147
+ draw(ht, heatmap_legend_side = "right", annotation_legend_side = "right")
148
+ dev.off()
149
+ ```
150
+
151
+ ## Template reuse rule
152
+
153
+ The local R materials are examples, not final style. When reusing them:
154
+
155
+ 1. Inspect only the nearest template folder.
156
+ 2. Keep useful data wrangling, statistics, and geoms.
157
+ 3. Replace ad hoc colors, oversized fonts, dense legends, and PNG-only export.
158
+ 4. Rebuild the final script around `theme_nature_contract()` and `save_pub_r()`.
159
+ 5. Add source-data output if the figure is manuscript-facing.
160
+
161
+ Open `references/r-template-index.md` for the local template atlas.
@@ -0,0 +1,251 @@
1
+ # Tutorials — Nature Figure Making
2
+
3
+ End-to-end walkthroughs for the most common publication figure types.
4
+ All examples use helpers from [api.md](api.md) and patterns from [common-patterns.md](common-patterns.md).
5
+ For real production scripts and output previews from figures4papers, open [demos.md](demos.md).
6
+
7
+ ---
8
+
9
+ ## Tutorial 1: Grouped bar chart (multi-metric comparison)
10
+
11
+ **Goal**: Several methods compared across multiple metrics. Legend in a dedicated panel.
12
+ When methods belong to related families, use one coherent baseline family plus one coherent hero family.
13
+
14
+ ```python
15
+ import os
16
+ import numpy as np
17
+ import matplotlib.pyplot as plt
18
+ from matplotlib import gridspec
19
+
20
+ # --- Style ---
21
+ plt.rcParams['font.family'] = 'sans-serif'
22
+ plt.rcParams['font.sans-serif'] = ['Arial']
23
+ plt.rcParams['svg.fonttype'] = 'none'
24
+ plt.rcParams['font.size'] = 24
25
+ plt.rcParams['axes.spines.right'] = False
26
+ plt.rcParams['axes.spines.top'] = False
27
+ plt.rcParams['axes.linewidth'] = 3
28
+
29
+ # --- Data ---
30
+ methods = ['ResNet1d18', 'ResNet1d34', 'ECGFounder', 'CSFM-Tiny', 'CSFM-Base', 'CSFM-Large']
31
+ colors = ['#484878', '#7884B4', '#B4C0E4', '#E4E4F0', '#E4CCD8', '#F0C0CC']
32
+ metrics = ['Metric 1', 'Metric 2', 'Metric 3']
33
+ mean = {
34
+ 'Metric 1': np.array([0.81, 0.83, 0.86, 0.89, 0.91, 0.92]),
35
+ 'Metric 2': np.array([0.63, 0.67, 0.71, 0.74, 0.77, 0.79]),
36
+ 'Metric 3': np.array([0.41, 0.45, 0.49, 0.53, 0.56, 0.58]),
37
+ }
38
+ std = {k: v * 0.03 for k, v in mean.items()} # placeholder
39
+
40
+ # --- Figure ---
41
+ fig = plt.figure(figsize=(28, 6))
42
+ gs = gridspec.GridSpec(1, len(metrics) + 1) # +1 for legend panel
43
+
44
+ handles, labels = None, None
45
+ for col, metric in enumerate(metrics):
46
+ ax = fig.add_subplot(gs[col])
47
+ bars = ax.bar(
48
+ range(len(methods)),
49
+ mean[metric],
50
+ yerr=std[metric],
51
+ capsize=5,
52
+ color=colors,
53
+ label=methods,
54
+ error_kw={'elinewidth': 2, 'capthick': 2},
55
+ )
56
+ if col == 0:
57
+ handles, labels = ax.get_legend_handles_labels()
58
+ ax.set_xticks([])
59
+ y_vals = mean[metric]
60
+ margin = (y_vals.max() - y_vals.min()) * 0.15
61
+ ax.set_ylim([y_vals.min() - margin, y_vals.max() + margin])
62
+ ax.set_ylabel(metric, fontsize=32)
63
+
64
+ # Legend-only panel
65
+ ax_leg = fig.add_subplot(gs[-1])
66
+ ax_leg.legend(handles, labels, fontsize=28, loc='center', frameon=False)
67
+ ax_leg.set_axis_off()
68
+
69
+ fig.tight_layout(pad=2)
70
+ os.makedirs('./figures', exist_ok=True)
71
+ fig.savefig('./figures/comparison.png', dpi=300)
72
+ fig.savefig('./figures/comparison.pdf', dpi=300)
73
+ plt.close(fig)
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Tutorial 2: Ablation bar chart (alpha-graduated, horizontal)
79
+
80
+ **Goal**: Same method with components progressively added; alpha encodes completeness.
81
+
82
+ ```python
83
+ import os
84
+ import numpy as np
85
+ import matplotlib.pyplot as plt
86
+
87
+ plt.rcParams['font.family'] = 'sans-serif'
88
+ plt.rcParams['font.sans-serif'] = ['Arial']
89
+ plt.rcParams['svg.fonttype'] = 'none'
90
+ plt.rcParams['font.size'] = 24
91
+ plt.rcParams['axes.spines.right'] = False
92
+ plt.rcParams['axes.spines.top'] = False
93
+ plt.rcParams['axes.linewidth'] = 3
94
+
95
+ configs = ['None', '+ Module A', '+ Module B', '+ Module C', 'Full']
96
+ values = np.array([0.72, 0.78, 0.81, 0.84, 0.88])
97
+ stds = np.array([0.02, 0.02, 0.01, 0.01, 0.01])
98
+
99
+ n = len(configs)
100
+ blue_rgb = (0.215686, 0.458824, 0.729412) # #3775BA
101
+ alphas = np.linspace(0.2, 1.0, n)
102
+ colors = [(blue_rgb[0], blue_rgb[1], blue_rgb[2], a) for a in alphas]
103
+
104
+ fig, ax = plt.subplots(figsize=(12, 6))
105
+ ax.barh(range(n), values, xerr=stds,
106
+ color=colors, ecolor='k', capsize=5)
107
+ ax.set_yticks(range(n))
108
+ ax.set_yticklabels(configs)
109
+ ax.set_xlim([values.min() - 0.05, values.max() + 0.03])
110
+ ax.set_xlabel('Score', fontsize=32)
111
+
112
+ fig.tight_layout(pad=2)
113
+ os.makedirs('./figures', exist_ok=True)
114
+ fig.savefig('./figures/ablation.png', dpi=300)
115
+ plt.close(fig)
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Tutorial 3: Multi-panel trend with shared legend
121
+
122
+ **Goal**: Two trend panels (e.g., train/val curves) and a legend-only third panel.
123
+
124
+ ```python
125
+ import os
126
+ import numpy as np
127
+ import matplotlib.pyplot as plt
128
+
129
+ plt.rcParams['font.family'] = 'sans-serif'
130
+ plt.rcParams['font.sans-serif'] = ['Arial']
131
+ plt.rcParams['svg.fonttype'] = 'none'
132
+ plt.rcParams['font.size'] = 15
133
+ plt.rcParams['axes.spines.right'] = False
134
+ plt.rcParams['axes.spines.top'] = False
135
+ plt.rcParams['axes.linewidth'] = 2
136
+
137
+ methods = ['Baseline', 'CSFM-Tiny', 'CSFM-Base', 'CSFM-Large']
138
+ colors = ['#7884B4', '#E4E4F0', '#E4CCD8', '#F0C0CC']
139
+ x = np.arange(0, 100, 5)
140
+
141
+ fig, axes = plt.subplots(1, 3, figsize=(18, 5))
142
+
143
+ for panel_idx, (ax, panel_name) in enumerate(zip(axes[:2], ['Training', 'Validation'])):
144
+ for method, color in zip(methods, colors):
145
+ y = 0.48 + 0.42 * (1 - np.exp(-x / 30)) + np.random.randn(len(x)) * 0.01
146
+ if method == 'Baseline':
147
+ y -= 0.03
148
+ elif method == 'CSFM-Tiny':
149
+ y += 0.00
150
+ elif method == 'CSFM-Base':
151
+ y += 0.02
152
+ elif method == 'CSFM-Large':
153
+ y += 0.03
154
+ ax.plot(x, y, color=color, lw=2.5, marker='o', markersize=6, label=method)
155
+ ax.set_title(panel_name, fontsize=18)
156
+ ax.set_xlabel('Epoch', fontsize=16)
157
+ ax.set_ylabel('Loss', fontsize=16)
158
+ if panel_idx == 0:
159
+ handles, labels = ax.get_legend_handles_labels()
160
+
161
+ # Legend-only panel
162
+ axes[2].legend(handles, labels, fontsize=14, loc='center', frameon=False)
163
+ axes[2].set_axis_off()
164
+
165
+ fig.tight_layout(pad=2)
166
+ os.makedirs('./figures', exist_ok=True)
167
+ fig.savefig('./figures/trends.png', dpi=300)
168
+ fig.savefig('./figures/trends.pdf', dpi=300)
169
+ plt.close(fig)
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Tutorial 4: Heatmap with dual colormaps (positive/negative columns)
175
+
176
+ **Goal**: Score matrix where positive = Reds, negative = Blues_r. Cell text auto-contrasted.
177
+
178
+ ```python
179
+ import os
180
+ import numpy as np
181
+ import matplotlib as mpl
182
+ import matplotlib.pyplot as plt
183
+
184
+ plt.rcParams['font.family'] = 'sans-serif'
185
+ plt.rcParams['font.sans-serif'] = ['Arial']
186
+ plt.rcParams['svg.fonttype'] = 'none'
187
+ plt.rcParams['font.size'] = 16
188
+ plt.rcParams['axes.spines.right'] = False
189
+ plt.rcParams['axes.spines.top'] = False
190
+ plt.rcParams['axes.linewidth'] = 2
191
+
192
+ # matrix: rows = methods, cols = metrics (alternating positive/negative directions)
193
+ methods = ['Method A', 'Method B', 'Method C', 'Method D']
194
+ metrics = ['Score (+)', 'Error (-)', 'F1 (+)', 'Loss (-)']
195
+ matrix = np.array([
196
+ [0.88, 0.12, 0.85, 0.20],
197
+ [0.81, 0.18, 0.78, 0.28],
198
+ [0.75, 0.25, 0.72, 0.35],
199
+ [0.70, 0.30, 0.68, 0.40],
200
+ ])
201
+
202
+ fig, ax = plt.subplots(figsize=(10, 6))
203
+ n_rows, n_cols = matrix.shape
204
+ vmin, vmax = matrix.min(0), matrix.max(0)
205
+
206
+ for j in range(n_cols):
207
+ is_positive = (j % 2 == 0)
208
+ cmap = plt.cm.Reds if is_positive else plt.cm.Blues_r
209
+ cmap = cmap.copy()
210
+ norm = mpl.colors.Normalize(
211
+ vmin=0 if is_positive else vmax[j],
212
+ vmax=vmax[j] if is_positive else 0
213
+ )
214
+ ax.imshow(matrix[:, j:j+1], cmap=cmap, norm=norm,
215
+ aspect='auto', extent=[j-0.5, j+0.5, 0, n_rows], origin='lower')
216
+
217
+ for (i, j), val in np.ndenumerate(matrix):
218
+ is_positive = (j % 2 == 0)
219
+ cmap = plt.cm.Reds if is_positive else plt.cm.Blues_r
220
+ norm = mpl.colors.Normalize(vmin=0 if is_positive else vmax[j],
221
+ vmax=vmax[j] if is_positive else 0)
222
+ r, g, b, _ = cmap(norm(val))
223
+ lum = 0.299*r + 0.587*g + 0.114*b
224
+ color = 'white' if lum < 0.5 else 'black'
225
+ ax.text(j, i + 0.5, f'{val:.2f}', ha='center', va='center',
226
+ fontsize=13, color=color)
227
+
228
+ ax.set_xlim(-0.5, n_cols - 0.5)
229
+ ax.set_xticks(np.arange(n_cols))
230
+ ax.set_xticklabels(metrics, rotation=30, ha='right', fontsize=14)
231
+ ax.tick_params(axis='x', bottom=False, top=False, length=0)
232
+ ax.set_yticks(np.arange(n_rows) + 0.5)
233
+ ax.set_yticklabels(methods, fontsize=14)
234
+ ax.set_frame_on(False)
235
+ ax.invert_yaxis()
236
+
237
+ fig.tight_layout(pad=2)
238
+ os.makedirs('./figures', exist_ok=True)
239
+ fig.savefig('./figures/heatmap.png', dpi=300)
240
+ plt.close(fig)
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Related files
246
+
247
+ - [SKILL.md](../SKILL.md) — When to use this skill
248
+ - [api.md](api.md) — Reusable helper implementations
249
+ - [common-patterns.md](common-patterns.md) — Layout and encoding patterns used above
250
+ - [design-theory.md](design-theory.md) — Why these choices exist
251
+ - [chart-types.md](chart-types.md) — Radar, 3D sphere, scatter, fill_between
@@ -0,0 +1,29 @@
1
+ # Figure contract before plotting
2
+
3
+ A publication-quality scientific figure is a visual argument, not an isolated pretty plot. Every figure starts from a claim, an evidence hierarchy, and a review-risk check before code or aesthetics. Before generating or editing code, establish the contract below.
4
+
5
+ ## Backend selection is a blocking gate
6
+
7
+ If the user has not explicitly chosen Python or R in the current request or provided a clearly language-specific input file/workflow, ask one concise question: **Python or R?** Then stop and wait for the user's answer. Do not generate mock data, write scripts, create figures, or choose Python/R by default. This overrides general autonomy/default-execution behavior for figure tasks.
8
+
9
+ Only recommend a backend when the user explicitly asks you to choose or recommend one. In that case, use `references/backend-selection.md`, state the reason, and then proceed with the recommended backend.
10
+
11
+ ## The selected backend is exclusive
12
+
13
+ Once Python or R is selected, every plotting script, preview image, SVG/PDF/TIFF/PNG export, QA render, and visual workaround must be produced by that same backend. Do not use Python to draw a preview for an R figure, and do not use R to draw a preview for a Python figure, even if the selected runtime or packages are missing locally. The non-selected language may only be used for non-visual file inspection or data conversion when it does not open a graphics device, import plotting libraries, create image/vector files, or change the final visual appearance.
14
+
15
+ ## Missing runtime/package rule
16
+
17
+ After the backend is selected, check the selected runtime early (`Rscript`/R for R; Python and required plotting packages for Python). If the selected runtime or required packages are unavailable, stop before rendering and report the exact blocker. You may provide a selected-backend script and installation commands, or ask permission to install dependencies, but you must not fall back to the other language to make a substitute figure.
18
+
19
+ ## The five-point contract
20
+
21
+ 1. **Core conclusion**: write the one-sentence claim the figure must defend.
22
+ 2. **Evidence chain**: map each planned panel to the claim, and drop panels that do not carry a unique piece of evidence.
23
+ 3. **Archetype**: classify the figure as `quantitative grid`, `schematic-led composite`, `image plate + quant`, or `asymmetric mixed-modality figure`.
24
+ 4. **Backend**: use the selected Python or R track exclusively for all figure drawing, previewing, exporting, and visual QA. Do not cross-render with the other language.
25
+ 5. **Journal/export contract**: set final dimensions, editable text, source data, statistics, image-integrity notes, and export formats before styling.
26
+
27
+ The highest-priority rule is: **the chart serves the scientific logic**. Aesthetic polish, template matching, and complex layout are subordinate to making the core conclusion clear, defensible, and reviewable.
28
+
29
+ For the full method to convert a request into core conclusion, evidence hierarchy, panel map, and review-risk checks, open `references/figure-contract.md`.
@@ -0,0 +1,37 @@
1
+ # Default operating stance
2
+
3
+ The older Python/matplotlib rules in this skill remain valid. The skill also supports R, especially `ggplot2 + patchwork + ComplexHeatmap + ggrepel + svglite/cairo_pdf + ragg`.
4
+
5
+ ## Color policy
6
+
7
+ Prefer **unified method families across all panels** over maximal hue separation. For dense Nature Machine Intelligence-style figure pages, use the low-saturation `NMI pastel` family described in `references/api.md` and reserve green/red mainly for gains, drops, and other directional cues.
8
+
9
+ ## Stance
10
+
11
+ - Start by classifying the requested figure into one of four archetypes: `quantitative grid`, `schematic-led composite`, `image plate + quant`, or `asymmetric mixed-modality figure`.
12
+ - Prefer one **hero panel** plus subordinate evidence panels over filling the canvas with equal-sized subplots.
13
+ - If the user asks for a single chart, still identify its role in the manuscript claim: discovery, mechanism, validation, comparison, robustness, or clinical/biological relevance.
14
+ - Keep the background white for plots and diagrams; switch to black only for microscopy / volume-rendering image plates.
15
+ - Prefer direct labels over legends when categories are spatially fixed or the legend would force unnecessary eye travel.
16
+ - Keep one restrained palette per figure: usually one neutral family, one signal family, and one accent family.
17
+ - Treat statistics, `n`, error-bar definitions, source-data traceability, and image-integrity notes as part of the figure, not as optional caption cleanup.
18
+ - When the user asks for broad `Nature` style rather than ML/NMI-specific style, read `references/nature-2026-observations.md` before choosing layout.
19
+ - When the user references `figures4papers` or the older `scientific-figure-making` skill, treat this skill as the successor and open `references/demos.md` for bundled Python demo scripts.
20
+
21
+ ## User-facing privacy rule
22
+
23
+ Do not disclose private local paths, private filenames, chat-attachment names, internal reference filenames, template identifiers, or the provenance of private working materials in user-facing replies, generated code comments, figure legends, reports, or manuscript text. Use generic descriptions such as "the provided R template collection", "a private working draft", or "the internal figure contract". If the user provides a private plotting template collection, use it only as an internal adaptation source and do not reveal its path, filenames, or provenance. Only reveal an exact path or source file when the user explicitly asks for that audit trail.
24
+
25
+ ## When to load this skill
26
+
27
+ - Python or R figures for **papers, slides, or reports** targeting Nature, Science, Cell, NeurIPS, ICLR, or similar venues.
28
+ - Requests involving **grouped bars, trend lines, heatmaps, radar plots, multi-panel grids**, or **PDF/SVG/high-DPI** output.
29
+ - Any mention of "Nature style", "publication figure", "paper figure", "SCI figure", "figures4papers", "scientific-figure-making", "R plotting template", or "high-quality scientific plot".
30
+ - Requests to improve a figure's logic, aesthetics, panel layout, figure legend, export quality, or journal-readiness.
31
+
32
+ ## When NOT to load
33
+
34
+ - Plotly, Altair, Bokeh, or other interactive/web-first plotting.
35
+ - EDA-only plots without a publication target.
36
+ - Primary workflow is 3D, GIS, or non-scientific illustration tooling.
37
+ - Illustrator / Figma–first layout.