Nodes/ComfyUI-LZNodes/LZ XY Grid Output
ComfyUI Node

LZ XY Grid Output

Turn a batch of comparisons into a labeled grid

By liz-ils·Created 7 months ago·Updated 12 days ago· 1
LZ XY Grid Output
  • images
  • image
  • parameter_text
x_axis_labels
y_axis_labels
columns0
label_font_size16
add_bordertrue

Run an XY sweep and what do you get? A flat batch of images in no particular visual order - useful for a workflow, useless for an eyeball. LZ XY Grid Output is the node that arranges that batch into a labeled grid: column labels across the top, row labels down the left, borders between cells, and it returns the assembled image ready to save or preview. It's the final step of the pack's XY plot system, and it's where a sweep stops being data and starts being a comparison you can actually read.

The arrangement follows the row-major order the samplers produce (y outer, x inner), so grid column i, row j is the image for the i-th x value and j-th y value. Wire the x_labels and y_labels strings straight out of the XY sampler and the grid labels itself.

The inputs

  • images - the batch, in row-major order.
  • x_axis_labels / y_axis_labels - multiline, one label per line. These come from the sampler's label outputs.
  • columns - how many images per row. 0 (default) auto-detects from the number of x labels.
  • label_font_size - 8 to 72, default 16. Drives the label text and the gutter size.
  • add_border - draws a thin black border around each cell. Default on, and worth keeping on; without borders the grid blurs together.
  • Outputs: image (the assembled grid, single image) and parameter_text (a text list of every cell's coordinates and labels - [0,1] X=... Y=... - handy for pasting into a log).

The error you'll hit

The one hard rule: the number of images must exactly equal columns × rows, or the node raises an error. This is the classic "grid won't assemble" failure and it's almost always because the labels don't match the batch. If you sampled 3 × 2 = 6 images but wired x labels from a different run with 4 entries, or you changed the sampler's axis values after generating, the count won't line up. The fix is to regenerate the batch and labels from the same run - which is exactly why the pack's samplers output labels alongside the images in one shot. If you hand it a plain batch with no labels, it falls back to numeric labels (x0, y1, ...), which is honest but not exactly a scientific presentation.

The font caveat

It tries to load arial.ttf for labels, and on systems without that file (many Linux setups) it falls back to PIL's tiny built-in bitmap font - legible, but ugly and hard to scale. If your labels come out looking like pixel mush, install a truetype font the PIL default can find, or just accept the fallback for casual sweeps.

Installing it

Part of the ComfyUI-LZNodes pack:

cd ComfyUI/custom_nodes
git clone https://github.com/liz-ils/ComfyUI-LZNodes

Restart ComfyUI, or ComfyUI Manager → search "ComfyUI-LZNodes". No extra dependencies, no model downloads.

The one-piece alternative is LZXYPlotSampler, which combines sampling and grid output in a single node. If you want to keep the two steps separate - sample one batch, re-grid it several ways - this node is the flexible half of that pair.

CategoryMyCustomNodes/XY

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE
x_axis_labelsSTRING
y_axis_labelsSTRING
columnsINT00–100
label_font_sizeINT168–72
add_borderBOOLEANtrue

Outputs (2)

NameTypeDescription
imageIMAGE
parameter_textSTRING