Plot
The MATLAB-style line plot hiding inside ComfyUI
- X
- Y
- image
Training a model is watching numbers change and asking "is that good or bad?" CdlPlot turns the numbers into a line. It's a faithful port of d2l's plot - the MATLAB-style plotting utility that appears on nearly every page of the Dive into Deep Learning book - and in ComfyDL it's how you visualize loss curves, learning-rate schedules, or any 1-D series that flows through your graph.
This is the single most useful visualization node in the pack, honestly. The whole point of ComfyDL is doing real deep learning in a node graph, and the one thing every training run produces is a monotonically (hopefully) decreasing loss curve. CdlPlot is how you see it.
How it works
You hand it X and Y tensors plus a pile of matplotlib kwargs, and it renders a line plot through matplotlib's Agg backend, converts the figure to a standard ComfyUI IMAGE tensor ([1, H, W, C]), and hands it back. Because the output is plain IMAGE - not the pack's private cdlTensor type - you can plug it straight into a Preview node, Save Image, or any stock ComfyUI image node.
Inputs that matter
X,Y- the data. Both optional cdlTensors: X can be 1-D or 2-D (multiple series as rows), Y likewise. Feed Y alone for an implicit index plot. For a classic training curve: X = step numbers, Y = loss tensor from your loss node.xlabel,ylabel- default to"x"/"y"; set them to something meaningful, it's a chart after all.xscale,yscale-linearorlog. Log-scale is the one you'll actually use - loss curves and learning rates both look far better on log axes.legend- comma-separated legend labels, one per series.xlim_min/xlim_max,ylim_min/ylim_max- only take effect when min < max (the -1 defaults are "unset"). Handy for zooming into the interesting part of a long run.figsize_w/figsize_h- figure size in inches, default 6×4.
Installing ComfyDL
As with every node in this pack, install once, use everywhere:
cd ComfyUI/custom_nodes
git clone https://github.com/Cynthia-lxx/ComfyDL
cd ComfyDL && pip install -r requirements.txt
Restart ComfyUI; it's under ComfyDL → Visualization. ComfyUI Manager: search "ComfyDL". Dependency footprint is matplotlib and nothing else - no model downloads.
Where people get stuck
The multi-series shapes are the usual trap. If you want three curves, Y should be [3, T] (three rows of T points) and X either a single [T] shared axis or its own [3, T]. Feed a [T, 3] and the node reads it as three series of length 3 - nonsense but plotted happily. When your chart comes out looking like a knot, transpose your tensor first.
Also: if X is left unconnected, you get an implicit integer index, which is fine for loss-vs-step plots. But wire the real step numbers in if you're comparing two runs with different lengths - an implicit index will happily overlay misaligned curves and make you think the training is converging when it isn't.
For one-off checks this is the node to reach for. If you want the plot embedded in the graph as a live display, note this pack ships an output-node variant of its heatmap visualizer but CdlPlot itself returns an IMAGE - so just terminate it with a Preview node and you're done.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| xlabel | STRING | x | — |
| ylabel | STRING | y | — |
| xscale | COMBO | linear | 2 options: linear, log |
| yscale | COMBO | linear | 2 options: linear, log |
| figsize_w | FLOAT | 6.01–30 | — |
| figsize_h | FLOAT | 4.01–30 | — |
| Xopt | TENSOR | — | |
| Yopt | TENSOR | — | |
| legendopt | STRING | — | |
| xlim_minopt | FLOAT | -1.0-1000000000–1000000000 | — |
| xlim_maxopt | FLOAT | -1.0-1000000000–1000000000 | — |
| ylim_minopt | FLOAT | -1.0-1000000000–1000000000 | — |
| ylim_maxopt | FLOAT | -1.0-1000000000–1000000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |