First Plot Spec¶
Goal¶
Run a reusable declarative plot spec instead of writing one Python call per plot.
Before You Start¶
- Create or load a PyFLASH object first.
- Use registry names such as
mean_bars, not Python function names such asplot_mean_bars. - YAML specs need PyYAML. The local
.[ui]extra includes it. - TOML specs use Python's built-in
tomllibon Python 3.11 and newer. On Python 3.9 or 3.10, installtomli. - JSON specs work without extra packages.
Steps¶
Create a file named plots.yaml:
Run it from Python:
from PyFLASH import load_state, run_spec
batch = load_state(r"C:\path\to\pickles\Example.pkl")
results = run_spec(batch, r"C:\path\to\plots.yaml")
print(results)
For multiple loaded objects, pass a dictionary and select one in the spec:
Check It Worked¶
run_specreturns a list with one result per plot entry.- Validation errors stop the run and explain what to fix.
- A failed plot entry returns
None, but later entries can still run.