MPL Line Plot
Trends from your DataFrame, rendered as a real image
- dataframe
- IMAGE
MPL Line Plot is the node you reach for when your data has a direction - a time series, a progression, anything where you want to see the trend, not just the values. Feed it a DataFrame with an x column and a y column, and out comes a Matplotlib line chart as a ComfyUI IMAGE you can preview, save, or fold back into a generation workflow.
It's part of HowToSD's ComfyUI-Data-Analysis pack, sharing the same engine as MPL Bar Chart and MPL Scatter - same inputs, same image conversion, different Matplotlib call. The README's example plot (a line chart in the pack's docs) is exactly this node in action: turn a stats table into a curve you can read at a glance.
How it works
The wrapper calls ax.plot(df[x_column], df[y_column]) after resolving your typed column names against the actual DataFrame (so numeric column labels typed as strings still match). Then the shared post-step handles the presentation: title, axis labels, an optional integer-ticks fix, and finally a render pipeline that saves the figure to a PNG buffer, converts it to RGB, and normalizes to a [0,1] image tensor with a batch dimension. Standard ComfyUI IMAGE on the way out.
The x_tick_as_int toggle deserves a mention because it exists for a real reason: when years or indices are stored as floats, Matplotlib likes to print 2002.5 on the axis. The toggle routes ticks through MaxNLocator(integer=True) so the axis reads 2002, 2003, ... instead.
Inputs and outputs
- dataframe (required,
DATAFRAME) - your data, loaded or transformed in the pack. - x_column_name / y_column_name (required,
STRING) - the columns to plot. - 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
Whenever the x axis is ordered - dates, seasons, rounds. It's the natural follow-up to a Pandas Group By that summarizes values per period, or directly on a loaded time series. A typical chain: Pandas Load CSV → Pandas Group By (mean per year) → MPL Line → Preview Image. If your x values are discrete categories with no inherent order, MPL Bar reads better.
Installing it
Same pack install as everything here. 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 engine here), seaborn, scipy, scikit-learn, openpyxl, lxml. No GPU - rendering is CPU Matplotlib. PyTorch nodes moved to ComfyUI-Pt-Wrapper in March 2025.
Gotchas
- Exact column names or a KeyError. Verify with Pandas Columns → a show node first if you didn't author the file.
- Holes in the data draw spikes or gaps. Fill NA or Drop NA before plotting for a clean line.
- Sort before you plot. If the x column isn't in order, a line chart will zigzag back and forth - sort the DataFrame first (Pandas Sort) or the "trend" is a lie.
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 | — |