ComfyUI Node

SNS Bar Chart

Bar Charts Straight Out of Your DataFrame — This Is the Workhorse

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

Every data-analysis workflow eventually wants a picture, and for categorical comparisons the bar chart is the picture. SNS Bar Chart is the Data Analysis pack's plotter for that: feed it a DataFrame plus the column names for your x and y axes, and it hands you an IMAGE you can save, preview, or drop into a bigger ComfyUI workflow.

It's one of the first plot nodes you'll actually reach for - the baseball-tutorial energy this pack is built around. Column names in, PNG-worthy image out.

How it works

Under the hood it's Seaborn's barplot wrapped as a node. You give it an x column (the categories) and one or more y columns (the values), and it draws a bar per x value. The y field accepts comma-separated column names, so a single node can stack several series side by side; a matching comma-separated legend_label gives each one a name. It then renders the figure through Matplotlib and returns the plot as a normal IMAGE tensor (RGB, 0-1 range), so it flows straight into Save Image or Preview Image.

Two details that trip people up. First, barplot aggregates - if your x column has repeated values, it plots the mean per category (with a confidence band by default). It's not a raw-values plot. Second, that x_tick_as_int checkbox exists because with year-like x data, Matplotlib will happily tick at 2002.5; tick it on to force integer ticks.

Inputs and outputs

The ones you'll actually set:

  • dataframe - your data.
  • x_column_name - the category column.
  • y_column_name - the value column(s), comma-separated for multiple.
  • title, x_axis_label, y_axis_label, legend_label - the dressing.
  • x_tick_as_int - force integer ticks on the x axis.
  • style and palette - Seaborn theme. style takes things like "darkgrid", "whitegrid", "dark"; palette takes names like "deep", "muted", "bright".

Output: one IMAGE.

Install

Ships in HowToSD/ComfyUI-Data-Analysis. Manager: search "Data analysis" in the Custom Node Manager, install, restart, reload the browser tab. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis   # README: example workflows need this folder name
pip install -r requirements.txt

This one pulls real weight: seaborn, matplotlib and pandas all have to be present (Manager installs them).

Common issues

Column-name typos fail loudly - the node validates column labels against the DataFrame and raises if a name doesn't exist. Remember the aggregation behavior: repeated x values collapse to means, which surprises people who expected a bar per row. And if your legend labels count doesn't match your y column count, the node pads the missing ones with blanks rather than erroring, so a half-labeled chart is a sign to check counts. The style/palette strings are passed straight to Seaborn, so an invalid palette name errors at runtime - stick to documented Seaborn names.

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