Our review
Generates matplotlib figure code for topological data analysis visualizations, following established style conventions from the trajectory_tda codebase.
Strengths
- Ensures consistency with publication-ready style constants (DPI, figure sizes, color palettes).
- Provides templates for common TDA figures (persistence diagrams, barcodes, null histograms, landscape comparisons).
- Enforces proper output paths for production and exploratory figures.
- Avoids ad-hoc formatting by using predefined constants and save functions.
Limitations
- Only works within the trajectory_tda codebase context (assumes specific module layout).
- Limited set of figure templates; customizations may still require manual code modification.
- No support for interactive or 3D plots.
When creating publication or supplemental figures for a TDA paper within the trajectory_tda project.
When generating figures outside the trajectory_tda ecosystem or when needing non-standard or highly customized visualizations.
Security analysis
SafeThe skill provides static guidelines and code patterns for generating matplotlib figures using a specific codebase. It does not instruct any execution of potentially harmful commands, network access, or file deletion. The content is purely instructional and poses no security risk.
No concerns found
Examples
/tda-figure-spec persistence-diagram P01-B/tda-figure-spec null-histogram P01-A/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_COLORSdict — nevertab10or default cycle - Observations:
#2d6a2e(green); Null:steelblue; Dim 0: green; Dim 1:#1a237e - Regimes:
plt.cm.tab10withREGIME_LABELSorder - Sequential/diverging:
viridis,plasma,RdBu_r— neverjet
Annotation standards
- p-values: write
p=0.003, notp<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.
Prompt Engineering
Data & AI
Prompt engineering best practices and templates to maximize AI outputs.
Data Visualization
Data & AI
Generates data visualizations and charts tailored to your data.
RAG Architecture Setup
Data & AI
Setup guide for RAG (Retrieval-Augmented Generation) architectures.