Générer des figures TDA prêtes pour publication

VérifiéSûr

Générer du code matplotlib pour des figures de qualité publication en suivant les conventions de trajectory_tda/viz, avec styles, tailles et annotations cohérents.

Spar Skills Guide Bot
Data & IAIntermédiaire
1002/08/2026
Claude Code
#tda#matplotlib#figure-generation#publication#visualization

Recommandé pour

Notre avis

Génère des figures TDA prêtes pour publication en créant du code matplotlib basé sur les constantes et modèles de style du projet.

Points forts

  • Impose un style de publication cohérent grâce à des constantes partagées.
  • Fournit des modèles prêts à l'emploi pour diagrammes de persistance, codes-barres, histogrammes nuls et comparaisons de paysages.
  • Enregistre automatiquement les figures en PDF et PNG avec une DPI appropriée.
  • Définit des règles explicites de couleurs et d'annotations pour éviter les choix ad hoc.

Limites

  • Nécessite le module trajectory_tda/viz/constants.py du projet.
  • Limitée aux types de figures listés dans les modèles.
  • Ne prend pas en charge les tracés interactifs ou les bibliothèques autres que matplotlib.
Quand l'utiliser

Utilisez cette compétence lors de la création de figures pour un article ou un supplément TDA dans ce codebase.

Quand l'éviter

Ne l'utilisez pas pour des tracés exploratoires hors projet ou avec d'autres bibliothèques de visualisation.

Analyse de sécurité

Sûr
Score qualité90/100

The skill provides formatting and style guidelines for generating matplotlib figures using an internal codebase. It contains no destructive, exfiltrating, or obfuscated instructions. It does not instruct the AI to perform any risky system operations.

Aucun point d'attention détecté

Exemples

Persistence diagram
/tda-figure-spec persistence-diagram P01-B
Null histogram
/tda-figure-spec null-histogram P01-A
Interactive selection
/tda-figure-spec

/tda-figure-spec — Generate Publication-Ready TDA Figures

Scaffold matplotlib figure code following the established trajectory_tda/viz/ conventions. Uses PUBLICATION_RC, DPI, FIGSIZE_*, STATE_COLORS, and _save_figure from the codebase — never ad-hoc sizes or colours.

Usage

/tda-figure-spec [figure-type] [paper-number]

Example: /tda-figure-spec persistence-diagram P01-B Example: /tda-figure-spec null-histogram P01-A Example: /tda-figure-spec (interactive)


Style constants (always import from trajectory_tda/viz/constants.py)

from trajectory_tda.viz.constants import (
    DPI, FIGSIZE_FULL, FIGSIZE_WIDE, FIGSIZE_HALF, FIGSIZE_SQUARE,
    PUBLICATION_RC, STATE_COLORS, STATES, STATE_LABELS, REGIME_LABELS,
)
import matplotlib.pyplot as plt
plt.rcParams.update(PUBLICATION_RC)

Figure size guide

| Use case | Constant | Size | |---|---|---| | Single full-width plot | FIGSIZE_FULL | 190mm × 120mm | | Wide two-panel | FIGSIZE_WIDE | 190mm × 104mm | | Half-width single panel | FIGSIZE_HALF | 90mm × 120mm | | Square heatmap | FIGSIZE_SQUARE | 90mm × 90mm |

Save function (always use this pattern)

def _save_figure(fig, output_dir: Path, name: str) -> None:
    output_dir.mkdir(parents=True, exist_ok=True)
    fig.savefig(output_dir / f"{name}.pdf", format="pdf")
    fig.savefig(output_dir / f"{name}.png", format="png", dpi=DPI)

Colour rules

  • State space: always STATE_COLORS dict — never tab10 or default cycle
  • Observations: #2d6a2e (green); Null: steelblue; Dim 0: green; Dim 1: #1a237e
  • Regimes: plt.cm.tab10 with REGIME_LABELS order
  • Sequential/diverging: viridis, plasma, RdBu_rnever jet

Annotation standards

  • p-values: write p=0.003, not p<0.01
  • Axes: remove top and right spines; keep bottom and left
  • Legends: frameon=False
  • Subplot labels: ax.text(0.02, 0.97, "(a)", transform=ax.transAxes, ...)

Figure templates available

| Template | When to use | |---|---| | plot_persistence_diagram(diagram, dim, ax) | Scatter birth-death pairs | | plot_barcode(diagram, dim, ax) | Feature lifetimes sorted by persistence | | plot_null_histogram(observed, null_dist, p_value, dim, ax) | Permutation test result | | plot_landscape_comparison(obs, null, grid, ax) | L² landscape distance (mandatory) |


Output paths

| Context | Path | Naming | |---|---|---| | Production paper figure | papers/PXX/figures/ | fig{N}_{desc}.{pdf\|png} | | Supplement | papers/PXX/figures/ | figS{N}_{desc}.{pdf\|png} | | Working / exploratory | figures/{domain}/ | YYYYMMDD_{desc}.png |

Working figures must not be saved to papers/PXX/figures/ — that is for production only.

Skills similaires