Nodes/ComfyUI-Data-Analysis/SNS Bar Chart Pt
ComfyUI Node

SNS Bar Chart Pt

Bar Chart a Tensor Directly — Skip the DataFrame Altogether

By HowToSD·Created 2 years ago·Updated about a year ago· 23
SNS Bar Chart Pt
  • tens
  • IMAGE
x_axis_dim0
y_axis_dims
title
x_axis_label
y_axis_label
legend_label
x_tick_as_intfalse
style
palette

Most of the pack's plot nodes want a DataFrame. SNS Bar Chart Pt is the exception that doesn't: it takes a plain PyTorch tensor and draws the bar chart straight from it. If your data lives in a tensor - image statistics, model outputs, anything from the PyTorch side of ComfyUI - this is the node that skips the pandas detour.

It's a niche in a pack full of niches, but when you need it, you need it. The pack's README notes that PyTorch-facing helpers have been migrating to a companion extension (ComfyUI-Pt-Wrapper); this node still consumes a TENSOR directly, so it pairs naturally with tensor outputs from anywhere in ComfyUI.

How it works

It's the same Seaborn barplot machinery as the DataFrame version, but the columns are tensor dimensions. You point at a column with x_axis_dim (a single integer index) and the value columns with y_axis_dims, which is a string parsed as a Python list literal - so "1" or "[1]" or "[1, 2]" all work. The node requires a rank-2 tensor (rows × columns), and it bars tens[:, x_axis_dim] against each tens[:, y_axes[i]]. Legend labels, if given, must not outnumber the y axes - it raises if you over-specify.

Tensors are moved to CPU and detached before plotting, so no CUDA headaches; the output is a normal IMAGE tensor for Save/Preview nodes.

Inputs and outputs

  • tens - the rank-2 TENSOR.
  • x_axis_dim - integer index of the x column (default 0).
  • y_axis_dims - string list literal of value columns, e.g. "[1]".
  • title, x_axis_label, y_axis_label, legend_label - labels; legend is comma-separated.
  • x_tick_as_int - force integer x ticks (for year-like data).
  • style, palette - Seaborn theme names.

Output: one IMAGE.

Install

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

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

Common issues

Rank is the hard requirement: anything that isn't a 2D tensor raises a clear "Only rank 2 tensors are supported" error, so flatten or reshape upstream. y_axis_dims parse failures (bad literal syntax) error loudly too. Legend count over-specification raises rather than silently padding. And remember this doesn't aggregate by category the way you might hope - it plots one bar per row of the tensor, like its DataFrame sibling. If you're not sure where your tensor columns land, print or preview the tensor first; the node won't guess for you.

CategoryData Analysis

Inputs (10)

NameTypeDefaultDescription
tensTENSOR
x_axis_dimINT0-100–1000000
y_axis_dimsSTRING
titleSTRING
x_axis_labelSTRING
y_axis_labelSTRING
legend_labelSTRING
x_tick_as_intBOOLEANfalse
styleSTRING
paletteSTRING

Outputs (1)

NameTypeDescription
IMAGEIMAGE