XYZ Grid Input
One Combo at a Time
- x_value
- y_value
- z_value
- x_index
- y_index
- z_index
- total_combinations
- grid_info
Automatic1111 has a built-in XYZ Plot script: type a few comma-separated values per axis, hit generate, and it grinds through every combination and hands you a labeled grid. ComfyUI, famously, doesn't. This whole pack exists to rebuild that idea, and XYZ Grid Input is the brain of it - the node that turns "red, blue, green" × "10, 20, 30" into one specific combination per run.
Here's the trick that makes it work without any custom samplers: instead of auto-running the whole sweep, ComfyUI queues one generation at a time, and you bump an index widget between runs. XYZ Grid Input does the bookkeeping. Feed it your comma-separated lists, set the index, and it hands you exactly the values for that slot.
How it works
Under the hood it's itertools.product on your three parsed lists. Every index maps to one combination, and the mapping order matches what A1111 users expect: X changes fastest, then Y, then Z. So index 0 is the first X with the first Y, index 1 is the second X with the first Y, and so on.
Two implementation details worth knowing. First, the index wraps around - set it higher than your total combination count and it silently starts over at the beginning instead of erroring. Second, the current combo is recomputed fresh on every run from your widgets, so there's no hidden state to go stale. What you see in the widget is what you get.
The inputs and outputs that matter
Only four inputs, all comma-separated strings except the index:
x_values,y_values,z_values- your lists. Leavez_valuesempty for a plain 2D grid; the node treats it as a single dummy value.index- the current combination slot. Start at 0 and increment by 1 for each run in the sweep.
The outputs are where it earns its keep:
x_value,y_value,z_value- the current values as strings. The text goes straight into a prompt node; anything numeric has to pass through the pack's XYZ String to Number node first, because a sampler won't accept"20".x_index,y_index,z_index- where you are in each axis, handy if you're doing something fancy with positioning.total_combinations- wire this to the XYZ Auto Collector so it knows when the sweep is done.grid_info- a human-readableCombination 3/9: X=green, Y=20, Z=...readout you can show with a text node.
Installing
The whole pack installs at once - there are no per-node dependencies. Either use ComfyUI Manager (search "XYZ Grid" or "XYZ Stitch") or:
cd ComfyUI/custom_nodes/
git clone https://github.com/psdwizzard/Comfyui-XYZ-stitch.git
Restart ComfyUI and the nodes appear under the "XYZ Grid" category. No requirements.txt, no model downloads, no hidden PyAV-style surprises - it's just torch, PIL, and numpy, which ComfyUI already ships.
Where people get burned
The #1 beginner mistake is forgetting to bump the index and staring at the same image nine times. Set index 0, queue, set index 1, queue, and so on - that's the whole workflow. The second gotcha is expecting the node to drive anything automatically. It's a pure function of its widgets; the "automation" lives in the collector and stitch nodes downstream, not here. And because it's a string node by design, don't try to feed y_value straight into a KSampler's steps input. The String to Number node is not optional, it's the adapter.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| x_values | STRING | red, blue, green | Comma-separated values for X axis |
| y_values | STRING | 1, 2, 3 | Comma-separated values for Y axis |
| z_values | STRING | cat, dog, tree | Comma-separated values for Z axis (leave empty to disable) |
| index | INT | 00–10000 | Current combination index (use 0 to start, increment for each run) |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| x_value | STRING | — |
| y_value | STRING | — |
| z_value | STRING | — |
| x_index | INT | — |
| y_index | INT | — |
| z_index | INT | — |
| total_combinations | INT | — |
| grid_info | STRING | — |