Document plotstyle and the Docker deployment switch in CLAUDE.md/README
Root-level docs hadn't caught up with the plotstyle package addition (KIT styling toolkit, plotting extra, plotstyle/CLAUDE.md pointer) or the earlier Singularity-to-Docker deployment switch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,10 @@
|
||||
- TUI: `gallery tui`
|
||||
- Config file stored under user `$HOME/.config/gallery`
|
||||
|
||||
### Producing Plots (`plotstyle`)
|
||||
|
||||
- Companion matplotlib styling toolkit (optional `plotting` extra) for producing figures that look consistent across a thesis and slide deck, ready to drop straight into a gallery source directory — see [Producing Plots with `plotstyle`](#producing-plots-with-plotstyle)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -54,6 +58,16 @@ gallery --help
|
||||
- Python packages are installed automatically by pip (Jinja2, PyYAML, PyMuPDF, Textual, argcomplete, platformdirs)
|
||||
- [ImageMagick](https://imagemagick.org/) is **optional** — used as a fallback if `PyMuPDF` is not available
|
||||
|
||||
### Optional: `plotstyle` (for producing plots)
|
||||
|
||||
```bash
|
||||
pip install -e ".[plotting]"
|
||||
# or
|
||||
uv sync --extra plotting
|
||||
```
|
||||
|
||||
This only installs `matplotlib` — it's kept out of the core dependencies so a plain gallery install stays lightweight. `plotstyle` also requires a local LaTeX toolchain (`latex` + `dvipng`) to be installed separately; see [Producing Plots with `plotstyle`](#producing-plots-with-plotstyle).
|
||||
|
||||
### Shell Completion (optional)
|
||||
|
||||
Install tab-completion for bash/zsh/fish:
|
||||
@@ -215,6 +229,37 @@ LaTeX formulas are supported in metadata values and rendered with MathJax:
|
||||
formula: "$$E = mc^2$$"
|
||||
```
|
||||
|
||||
## Producing Plots with `plotstyle`
|
||||
|
||||
`plotstyle` is a companion matplotlib styling toolkit shipped in this repo (the `plotstyle/` package) for producing the plots you'll point a gallery source at — a KIT (Karlsruhe Institute of Technology) corporate-design color palette, consistent spines/ticks/gridlines, LaTeX text in a modern sans font, and a few building-block functions (figure titles with a parameters subtitle, a same-size colorbar helper, an outside-axes legend, panel labels). It has no code dependency on `gallery` — the two only meet on disk, through the PDF files (and optional `metadata.yaml`) a `plotstyle` script writes into a directory that `gallery` then scans.
|
||||
|
||||
Install it with the `plotting` extra (see [Installation](#installation)) and make sure a LaTeX toolchain (`latex` + `dvipng`) is available locally — `plotstyle` always renders text through real LaTeX, there's no fallback.
|
||||
|
||||
```python
|
||||
import numpy as np
|
||||
import plotstyle as ps
|
||||
|
||||
ps.use() # once, before creating any figure
|
||||
|
||||
fig, ax = ps.new_figure(
|
||||
"thesis-single",
|
||||
title="Measured signal",
|
||||
params={"N": 512, "seed": 42},
|
||||
)
|
||||
x = np.linspace(0, 10, 200)
|
||||
ax.plot(x, np.sin(x), label="signal")
|
||||
ax.set_xlabel("Time (s)")
|
||||
ax.set_ylabel(r"Amplitude $A(t)$")
|
||||
ps.style_legend(ax, title="Series")
|
||||
|
||||
# Save straight into a gallery source directory:
|
||||
ps.savefig(fig, "/path/to/plots/measured_signal", formats=("pdf",))
|
||||
```
|
||||
|
||||
That PDF (plus an optional `metadata.yaml` next to it, as described above) is exactly what `gallery generate --source /path/to/plots` picks up — `gallery` converts the PDF to a thumbnail PNG itself, so `plotstyle` scripts should stick to `formats=("pdf",)` rather than also producing a PNG.
|
||||
|
||||
See `examples/plotstyle_showcase.ipynb` for a fully rendered tour of every function, and `plotstyle/CLAUDE.md` for the full API reference and best practices (aimed at coding agents, but equally useful for humans).
|
||||
|
||||
## Shortcuts
|
||||
|
||||
| Icon | Button | Function | Shortcut |
|
||||
|
||||
Reference in New Issue
Block a user