Area Chart
Plot a training curve as a filled area chart, straight from a tensor
- Y
- X_vals
- image
CdlAreaChart takes a tensor and renders it as a filled area chart, then hands you back a real ComfyUI IMAGE you can preview or save. If you've ever trained a model and wished the loss curve was visible in the node graph instead of in a separate script, this is the node that closes that gap. It's part of ComfyDL's Visualization category, and it's one of the friendlier ways to see what your training data actually looks like.
How it works
Under the hood it's matplotlib. A single series gets drawn with fill_between; turn on stacked and it switches to stackplot for multiple overlapping series. The tensor goes to numpy, the plot is drawn, and the figure is converted straight to an IMAGE tensor - so unlike a raw cdlTensor, this output wires into ComfyUI's standard PreviewImage / SaveImage nodes with no conversion drama.
The mechanics are simple but worth knowing:
- Your
Ytensor is treated as the series values. If it's 1-D it's reshaped to one series of lengthT; if it's 2-D, the rows are the series and the columns are the time points. - The x-axis defaults to
0, 1, 2, …for each point. Pass the optionalX_valstensor if you want real x positions (epochs, iterations, dates). - For
stacked, you wantYshaped[series, time]so the stacks pile up correctly.
Inputs and outputs
Required:
Y- thecdlTensorof values to plot.stacked- boolean, default off; multi-series mode.alpha- fill transparency (0.1–1.0, default 0.5).color_palette- matplotlib palette name, defaulttab10.xlabel,ylabel- axis labels, empty by default.figsize_w,figsize_h- figure size in inches (defaults 7×4).
Optional:
X_vals- x positions as acdlTensor.labels- comma-separated series names for the legend in stacked mode.
The one output is image, type IMAGE.
Where you'd use it
The classic use: track a metric over training and watch the curve in the graph - the README's linear-regression example wires residuals and losses into histogram/plot nodes exactly this way. If you've got loss-per-epoch from a ComfyDL training loop, an area chart is a nicer read on the same data than a plain line. Just remember it's a chart of data you already have, not a live training monitor - ComfyUI doesn't stream updates mid-run, you get the chart when the queue item completes.
Installing it
It ships with ComfyDL, so it's one install for all 106 nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Cynthia-lxx/ComfyDL
pip install -r ./ComfyDL/requirements.txt
Then restart ComfyUI - or search "ComfyDL" in ComfyUI Manager. matplotlib is the only dependency this pack adds; the plot nodes in this file all depend on it, and it's the one thing to check if your charts come back empty or throw on import.
Gotchas
- Feed a 1-D tensor and
stackedwill just render one series - there's nothing to stack. Use[series, time]. - Empty input tensors render a polite "No data" placeholder rather than crashing - a nice touch, but it means a blank chart is often a sign your tensor is empty, not broken.
labelsis comma-separated; mismatched label counts are truncated silently, so double-check you have one label per series.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| Y | TENSOR | — | |
| stacked | BOOLEAN | false | — |
| alpha | FLOAT | 0.500.1–1 | — |
| color_palette | STRING | tab10 | — |
| xlabel | STRING | — | |
| ylabel | STRING | — | |
| figsize_w | FLOAT | 7.03–20 | — |
| figsize_h | FLOAT | 4.02–20 | — |
| X_valsopt | TENSOR | — | |
| labelsopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |