Nodes/ComfyDL/Scatter
ComfyUI Node

Scatter

Seeing 10,000 points instead of 10,000 numbers

By Cynthia-lxx·Created 2 months ago·Updated 2 days ago· 6
Scatter
  • X
  • Y
  • color_map
  • size_map
  • image
alpha0.60
cmapviridis
xlabel
ylabel
figsize_w6.0
figsize_h5.0

Plots are for trends, scatter plots are for shapes. CdlScatter is ComfyDL's wrapper around matplotlib.pyplot.scatter, and it's the node you reach for when you want to see the actual distribution of your data - the clusters, the outliers, the weird diagonal your linear model will never fit. In a pack whose whole point is learning deep learning by doing it, scatter is how you see your dataset before and after.

Classic ComfyDL move: a synthetic-data node generates points, you scatter them, and suddenly every textbook paragraph about "linearly separable data" makes sense because you can see it with your own eyes.

The inputs

  • X, Y - coordinate tensors, flattened internally. Both required.
  • alpha - point transparency (default 0.6). Lower it when you've got tens of thousands of points and they'd otherwise blob into a solid mass.
  • cmap - colormap for the optional color encoding (default viridis).
  • xlabel, ylabel, figsize_w, figsize_h - the usual.
  • color_map - the interesting optional input: a per-point value tensor that gets mapped through the colormap. Feed it a class label per point and your scatter becomes a colored cluster plot instantly.
  • size_map - per-point size values. Handy for a third dimension on a 2-D plot.

Output: image, a standard [1, H, W, C] IMAGE - so unlike the pack's private cdlTensor plumbing, you can preview it, save it, or pass it to stock ComfyUI nodes.

Installing ComfyDL

The usual light install:

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, or search "ComfyDL" in ComfyUI Manager. matplotlib is the only extra dependency.

Where people get stuck

Lengths must match. X and Y are flattened, and color_map/size_map are flattened too - a color_map with a different length than X/Y throws immediately, and matplotlib's error won't be gentle. When you're wiring a [B, C] batch through, remember every point needs a color and a size if you're using those channels.

The classic beginner mistake: trying to scatter a 2-D tensor where each row is a point - feeding [N, 2] straight in. The node flattens it, which scrambles your point pairs. Split the columns into X and Y first, or you'll get a perfectly drawn, completely wrong scatter.

Where it shines: plot the same data before training and after a few SGD Step iterations of a classifier - watching the clusters separate in real time is the single best argument for this pack existing. And if your scatter looks like a solid black rectangle, that's an alpha problem, not a data problem - drop alpha toward 0.2 and the structure appears.

Categoryd2l/Visualization

Inputs (10)

NameTypeDefaultDescription
XTENSOR
YTENSOR
alphaFLOAT0.600.1–1
cmapSTRINGviridis
xlabelSTRING
ylabelSTRING
figsize_wFLOAT6.02–20
figsize_hFLOAT5.02–20
color_mapoptTENSOR
size_mapoptTENSOR

Outputs (1)

NameTypeDescription
imageIMAGE