Metadata-Version: 2.5
Name: sci-figures
Version: 0.3.0
Summary: Style, mm layout, recurring elements and export for Nature-style research figures with editable text.
Project-URL: Source, https://github.com/quadbio/sci-figures
Author: quadbio
License-Expression: MIT
License-File: LICENSE
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.12
Requires-Dist: matplotlib>=3.8
Provides-Extra: examples
Requires-Dist: anndata; extra == 'examples'
Requires-Dist: pyyaml; extra == 'examples'
Requires-Dist: scanpy>=1.10; extra == 'examples'
Provides-Extra: spatial-examples
Requires-Dist: anndata; extra == 'spatial-examples'
Requires-Dist: cellcharter>=0.3.7; extra == 'spatial-examples'
Requires-Dist: geopandas; extra == 'spatial-examples'
Requires-Dist: lightning; extra == 'spatial-examples'
Requires-Dist: pyyaml; extra == 'spatial-examples'
Requires-Dist: scanpy>=1.10; extra == 'spatial-examples'
Requires-Dist: shapely>=2; extra == 'spatial-examples'
Requires-Dist: sopa>=2.2; extra == 'spatial-examples'
Requires-Dist: spatialdata-plot>=0.4.2; extra == 'spatial-examples'
Requires-Dist: spatialdata>=0.8; extra == 'spatial-examples'
Requires-Dist: squidpy>=1.8; extra == 'spatial-examples'
Requires-Dist: torch; extra == 'spatial-examples'
Description-Content-Type: text/markdown

# sci-figures

A Claude Code plugin for Nature-style research figures (main, Extended Data, supplementary) and their legends. The
agent writes the plotting code (matplotlib, seaborn, scanpy, spatialdata-plot); the skill says what the result must
achieve, from the figure's message to its export as one PDF with editable Arial text, and has independent reviewers
check the layout and the legend against the code.

| Part | What it does |
| --- | --- |
| `skills/sci-figures/` | The workflow, visual and legend conventions, the two reviews, setup, and two complete example figures (outline, script, legend). Loaded on demand. |
| `src/scifig/` | `apply_style`, mm layout (`new_figure`, `add_axes_mm`, `panel_letter`), recurring elements (`badge`, `colorbar`, `embedding_axes`, `scale_bar`) and `save`, which checks fonts, sizes and raster resolution. |

## Use

Ask Claude for a figure, a panel or a legend in the repo that holds the figure scripts.

1. It agrees the format and an outline with you (message, story line, one entry per panel) and saves the outline
   next to the script.
2. It computes the plotted data, then writes one script per figure that only loads and plots it.
3. It checks the preview against the layout checklist, writes the legend from the code and the data, and runs the
   layout and legend reviews in parallel.
4. It shows you the PDF with its legend and lists the review findings it declined.

Colors and marks shared across a paper's figures live in the repo's `resources/figure_conventions.yaml`.

## Install

**The plugin**, once per machine, from the [quadbio marketplace](https://github.com/quadbio/claude-plugins).

**The package**, Arial and TeX (for equations): [`skills/sci-figures/references/setup.md`](skills/sci-figures/references/setup.md).

## Develop

```bash
uv sync --group dev
uv run python -m scifig.fonts   # Arial, once per machine
uv run pytest                   # the equation test is skipped without TeX
uv run pre-commit run --all-files
claude plugin validate .
claude --plugin-dir .           # try the skill from this checkout
```

The example figures: `uv run --extra examples python skills/sci-figures/examples/fig1_moscot.py` writes
`figures/fig1_moscot.pdf`, its legend and preview (needs TeX). The spatial one needs the `spatial-examples` extra and the
Xenium dataset (`fig2_spatial_outline.md`, Source): run `fig2_spatial_data.py` (about 7 min on 8 cores), then
`fig2_spatial.py`.

For live package edits in a figure repo, depend on the checkout instead:
`sci-figures = { path = "../sci-figures", editable = true }`.

## Release

Bump `version` in `.claude-plugin/plugin.json` and merge: the marketplace follows `main`, and users update when the
version changes. On that merge, `release.yaml` publishes the package to PyPI as `sci-figures`, then tags `v<version>` and
creates a GitHub Release.

## License

MIT
