ComfyUI Node

SNS Line Plot

Line charts in ComfyUI — no Python, no leaving the graph

By HowToSD·Created 2 years ago·Updated about a year ago· 23
SNS Line Plot
  • dataframe
  • IMAGE
x_column_name
y_column_name
title
x_axis_label
y_axis_label
legend_label
x_tick_as_intfalse
style
palette

Yes, you can draw a line chart entirely inside ComfyUI, wire it into the same Save Image node you use for your generations, and never touch a line of Python. That's what SNS Line Plot does: it's a thin wrapper around Seaborn's lineplot, fed by the pandas DataFrames that flow around the rest of the HowToSD/ComfyUI-Data-Analysis pack. ComfyUI wasn't built for tabular data, but this pack treats it like a graph problem anyway - load a CSV with Pandas Load CSV, slice and filter with the pandas nodes, and render the result here.

What you feed it

The node takes a dataframe socket plus the usual label fields. The three that actually do the work:

  • x_column_name - which column becomes the x-axis.
  • y_column_name - which column(s) become y. Here's the party trick: enter multiple column names comma-separated, like close,volume_ma, and you get one line per series on the same axes.
  • legend_label - comma-separated labels that match your y columns. If you leave it blank, lines are drawn with no legend; if you give fewer labels than series, the rest just get empty labels. It won't crash, which is more than I can say for some plotting APIs.

Everything else is polish: title, x_axis_label, y_axis_label, and x_tick_as_int, a boolean that forces integer x ticks. If your dates render as 2002.5, flip that and you get 2002. The style and palette fields accept Seaborn theme names - darkgrid/whitegrid/dark/white/ticks for style, deep/muted/pastel/bright/dark/colorblind for palette. Leave them empty and you get sensible defaults.

How it works under the hood

The class pulls the column names you typed, validates them against the DataFrame's real columns (more on that below), then calls sns.lineplot once per y column on a shared matplotlib axes. The finished figure is rendered to a PNG in memory and converted to a normalized float tensor, so the output is an IMAGE - same type a VAE spits out. You can plug it straight into Save Image, a preview node, or anything else that takes an image. That's the elegant part of the whole pack: plots become first-class citizens of your graph.

Installing it

Install the pack, not the node. In ComfyUI Manager search "Data analysis", pick ComfyUI-Data-Analysis, install, restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git

The README has a real gotcha: rename the cloned folder from ComfyUI-Data-Analysis to data-analysis, or the bundled example workflows won't load (they hardcode the folder name). No GPU required - this is all CPU pandas/matplotlib. But it does pull in real dependencies that stock ComfyUI doesn't ship: pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml. Manager installs them automatically; if you clone by hand, run pip install -r requirements.txt or the nodes will silently fail to register.

Where people get burned

Column names are checked against the DataFrame, not guessed. Type a column name that doesn't exist and you get a ValueError: Column 'x' not found in the DataFrame. instead of a mysteriously empty chart - annoying at first, but honestly a gift. Stick a Pandas Show DataFrame node in front so you can see the real column names. Also, the DataFrame sockets connect at the top-left corner of the input field, not the obvious center spot; hover around the corner until the wire snaps. Weird, but you'll get used to it.

CategoryData Analysis

Inputs (10)

NameTypeDefaultDescription
dataframeDATAFRAME
x_column_nameSTRING
y_column_nameSTRING
titleSTRING
x_axis_labelSTRING
y_axis_labelSTRING
legend_labelSTRING
x_tick_as_intBOOLEANfalse
styleSTRING
paletteSTRING

Outputs (1)

NameTypeDescription
IMAGEIMAGE