MPL Scatter Plot
See the relationship between two columns at a glance
- dataframe
- IMAGE
MPL Scatter Plot is the node for the question "is there a relationship between these two columns?" It takes a DataFrame, an x column, and a y column, and returns a Matplotlib scatter plot as a ComfyUI IMAGE - every row becomes a dot, and patterns you'd never spot in the table jump out immediately. Cluster, correlation, or total noise: one run and you know.
It's part of HowToSD's ComfyUI-Data-Analysis pack, sharing the exact input set and render pipeline with MPL Bar and MPL Line - the only difference is the Matplotlib call underneath. Same author, same philosophy: do the Pandas work in the graph, then see the result.
How it works
The wrapper resolves your typed column names against the DataFrame, then calls ax.scatter(df[x_column], df[y_column]) - one dot per row. Then the shared post-step takes over: title and axis labels applied, figure saved to a PNG buffer, converted to RGB, normalized to a [0,1] image tensor with a batch dimension. Standard ComfyUI IMAGE output. The x_tick_as_int toggle is there too, fixing the float-year-ticks problem (2002.5) via MaxNLocator(integer=True).
Because it's a scatter, the node expects many rows - the resolution of the chart depends on how much data you feed it. Ten rows give you a lonely little chart; a thousand rows show real structure.
Inputs and outputs
- dataframe (required,
DATAFRAME) - your data, loaded or transformed. - x_column_name / y_column_name (required,
STRING) - the two columns to compare. - title, x_axis_label, y_axis_label (required,
STRING, default empty). - x_tick_as_int (required,
BOOLEAN, default false) - integer x ticks. - IMAGE output - into Preview Image or Save Image.
When you'd reach for it
Exploration. Before you build a fancy aggregation or model, scatter the candidate columns against each other and check whether the relationship is even there. In the pack's terms: load the stats CSV, pick two numeric columns, plot, and immediately see if hits track with something else. It pairs naturally with Pandas Corr - scatter shows you the shape, corr gives you the number.
It's also the honest check before you trust a correlation coefficient. A single outlier can pump up a Pearson value while the scatter shows you it's one weird point. See it first.
Installing it
Pack install, once. ComfyUI Manager: search "Data analysis", install ComfyUI-Data-Analysis, restart, reload. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis
mv ComfyUI-Data-Analysis data-analysis # README: examples expect this folder name
pip install -r data-analysis/requirements.txt
Dependencies: pandas, matplotlib (the rendering engine), seaborn, scipy, scikit-learn, openpyxl, lxml. No GPU - CPU Matplotlib. PyTorch nodes moved to ComfyUI-Pt-Wrapper in March 2025.
Gotchas
- Exact column names or a KeyError. Confirm names via Pandas Columns → a show node if you didn't author the file.
- NA values get dropped from the plot silently. If the chart looks thin, that's why - run Pandas Drop NA or Fill NA first if you want to control it.
- Column dtypes matter. Scatter on two text columns errors; both should be numeric. Cast with Pandas As Float if needed.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — | |
| x_column_name | STRING | — | |
| y_column_name | STRING | — | |
| title | STRING | — | |
| x_axis_label | STRING | — | |
| y_axis_label | STRING | — | |
| x_tick_as_int | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |