Plot example — a cell-size histogram
A complete plot — the two files a plot is, in the two-file layout the Plots
tab expects: plot.yaml (the manifest: what port it binds to, how
it renders) and render.py (the script: render(collection) → a
matplotlib figure). Copy the folder into your project's plots/ directory and
relink the target in the GUI, or scaffold a fresh plot with the
scaffold_plot tool and compare.
What to notice
- Binding is by node id and port, never by label. The
targetblock names the workflow file, thenode_id, and theoutput_port; two nodes with the same display label stay distinct. - The script imports nothing from SciStudio. Everything arrives through
collection:collection.items.open()reads every table in the batch,open_one()the first. (A package type opens as its core base type — anImageopens as a NumPy array.) render(collection)— exactly that signature. ReturningNoneis an error; return a figure, a path to an image you wrote in the working directory, or a list of either.- A plot is preview-only. It never becomes a workflow node and never feeds
another step; the rendered files are a cache the next run overwrites. A
figure that must be kept is a block output (an
Artifact), not a plot.
The script pools one column across every table in the batch into a single
histogram — the smallest realistic render. For the full contract (house
style, figure sizes, the R/ggplot2 form), see the writing-plots.md page of
this guide.