figure-generator
Generates figures from placeholders in .tex files. Creates Python matplotlib scripts for data figures, TikZ/Python schematics for diagrams. Maintains a shared plot_defaults.py for consistent styling. Flags complex figures for the user. Runs after the writer skill.
What this skill does
# Figure Generator
## Overview
This skill runs after the `writer` skill has produced LaTeX prose. It reads .tex files, finds figure placeholders, and generates actual figures where possible. It replaces `\figurePlaceholder{...}` blocks with `\includegraphics{...}` pointing to generated output.
## When to Use This Skill
- After `writer` has produced .tex files containing figure placeholders
- When updating figures after data or methods changes
- When regenerating specific figures
## Plot Defaults File
**Before generating any figures**, check for `figures/plot_defaults.py` in the document directory. If it does not exist, create it. This file defines all shared styling for consistency across the entire thesis.
```python
# figures/plot_defaults.py
# Shared matplotlib defaults for all thesis figures.
# Edit this file to change styling globally.
import matplotlib.pyplot as plt
import matplotlib as mpl
# --- Colour palette ---
COLOURS = {
'primary': '#1f77b4',
'secondary': '#ff7f0e',
'tertiary': '#2ca02c',
'quaternary': '#d62728',
'grey': '#7f7f7f',
'light_grey': '#c7c7c7',
}
COLOUR_CYCLE = [COLOURS['primary'], COLOURS['secondary'], COLOURS['tertiary'],
COLOURS['quaternary'], COLOURS['grey']]
# --- Figure sizes (inches) ---
SINGLE_COL = (6.5, 4.0)
DOUBLE_COL = (6.5, 3.0) # wide but short
HALF_COL = (3.15, 3.0) # for subfigures
# --- Font and text ---
FONT_FAMILY = 'serif'
FONT_SIZE = 10
LABEL_SIZE = 11
TICK_SIZE = 9
LEGEND_SIZE = 9
# --- Line and marker ---
LINE_WIDTH = 1.5
MARKER_SIZE = 4
# --- Export ---
DPI = 300
FORMATS = ['pdf', 'png'] # pdf for LaTeX, png for preview
def apply():
"""Apply thesis defaults to matplotlib rcParams."""
mpl.rcParams.update({
'font.family': FONT_FAMILY,
'font.size': FONT_SIZE,
'axes.labelsize': LABEL_SIZE,
'axes.titlesize': LABEL_SIZE,
'xtick.labelsize': TICK_SIZE,
'ytick.labelsize': TICK_SIZE,
'legend.fontsize': LEGEND_SIZE,
'figure.figsize': SINGLE_COL,
'figure.dpi': DPI,
'savefig.dpi': DPI,
'savefig.bbox': 'tight',
'lines.linewidth': LINE_WIDTH,
'lines.markersize': MARKER_SIZE,
'axes.prop_cycle': mpl.cycler(color=COLOUR_CYCLE),
})
def savefig(fig, path_stem):
"""Save figure in all configured formats."""
for fmt in FORMATS:
fig.savefig(f'{path_stem}.{fmt}', dpi=DPI, bbox_inches='tight')
```
**Every generated script must**:
1. `import plot_defaults; plot_defaults.apply()` at the top
2. Use `plot_defaults.savefig(fig, path)` to export
3. Reference `plot_defaults.COLOURS`, `plot_defaults.SINGLE_COL`, etc. for sizing and colours
**If `plot_defaults.py` already exists**, read it and respect the author's customisations. Only add missing keys — never overwrite existing choices.
## Figure Categories
### 1. Data Plots (auto-generate)
For placeholders that specify data sources, generate Python scripts using matplotlib:
**Input** (from placeholder):
- Data source path (CSV, HDF5, or reference to source code that produces data)
- Plot type (time series, scatter, bar chart, box plot, Bland-Altman, etc.)
- Axes labels and units
- Key features to highlight
**Output**:
- Python script in `figures/scripts/` that reads data and produces the plot
- Generated figure in `figures/` (PDF and PNG)
- Updated .tex with `\includegraphics` replacing the placeholder
**Script requirements**:
- Self-contained: runs independently with `python script.py`
- Imports and applies `plot_defaults` for consistent styling
- Uses matplotlib only (not seaborn)
- Outputs both PDF (for LaTeX) and PNG (for preview)
### 2. Simple Schematics (auto-generate)
For block diagrams, system architectures, signal processing pipelines:
**Approach**: Generate using TikZ directly in LaTeX, or Python (matplotlib/networkx) for more complex diagrams.
**Types**:
- Block diagrams of systems/methods
- Signal processing pipelines
- Simple circuit representations
- Algorithm flowcharts
- Data flow diagrams
### 3. Complex/Custom Figures (flag for user)
Some figures cannot be auto-generated:
- Photographs or microscopy images
- Figures requiring the author's unpublished data in inaccessible formats
- Highly specialised domain diagrams
- Figures requiring specific artistic choices
**Action**: Keep the placeholder but add a `% TODO: MANUAL FIGURE REQUIRED` comment explaining what's needed and why it couldn't be auto-generated.
## Workflow
1. **Check defaults**: Read or create `figures/plot_defaults.py`
2. **Scan**: Read .tex file(s), find all figure placeholder blocks
3. **Classify**: For each placeholder, determine category (data plot / schematic / complex)
4. **Generate**: For auto-generatable figures:
a. Create Python script (importing plot_defaults) or TikZ code
b. Run script to produce figure file
c. Replace placeholder with `\includegraphics`
5. **Flag**: For complex figures, add TODO comments
6. **Report**: Summary of what was generated, what was flagged, any issues
## LaTeX Integration
Replace:
```latex
\begin{figure}[tb]
\centering
\fbox{\parbox{0.8\textwidth}{
\textbf{FIGURE PLACEHOLDER}\\[1em]
...
}}
\caption{Caption text.}
\label{fig:label}
\end{figure}
```
With:
```latex
\begin{figure}[tb]
\centering
\includegraphics[width=\columnwidth]{figures/fig_label}
\caption{Caption text.}
\label{fig:label}
\end{figure}
```
## What This Skill Does NOT Do
- Does not change prose content
- Does not add or remove figures beyond what the plan specifies
- Does not modify captions (preserves writer's captions)
- Does not change figure labels or cross-references
## Integration
- **Receives from**: `writer` skill (.tex files with figure placeholders)
- **Reads**: Data files referenced in placeholders, source code for data generation
- **Maintains**: `figures/plot_defaults.py` (shared styling for all thesis figures)
- **Produces**: Figure files in `figures/`, Python scripts in `figures/scripts/`, updated .tex files
- **Hands off to**: `formatter` skill for final LaTeX polish
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.