ComfyUI Node

MPL Pie Chart

Proportions at a glance, straight from a DataFrame

By HowToSD·Created 2 years ago·Updated about a year ago· 23
MPL Pie Chart
  • dataframe
  • IMAGE
label_column_name
data_column_name
title

MPL Pie Chart answers "what share of the whole is each part?" - and nothing says that faster than a pie. Give it a DataFrame with a label column and a data column, and it hands back a Matplotlib pie chart as a ComfyUI IMAGE, complete with percentage labels drawn on each slice. It's the most visual node in the pack's MPL family, and the one you reach for when the story is about proportions.

It's part of HowToSD's ComfyUI-Data-Analysis pack, alongside MPL Bar, MPL Line, and MPL Scatter. It's also the odd one out among them: instead of the shared x/y input set, it takes label_column_name and data_column_name, because a pie has no axes - it has slices and labels.

How it works

The node resolves your two column names against the DataFrame, then calls ax.pie(df[data_column], labels=df[label_column], autopct='%1.1f%%', startangle=140). That autopct is what draws the "25.0%" text on each slice, and startangle=140 rotates the chart so the first slice doesn't start at 3 o'clock. From there it's the shared render pipeline: title set, figure saved to a PNG buffer, converted to RGB, normalized to a [0,1] image tensor - a standard ComfyUI IMAGE on the output.

Inputs and outputs

  • dataframe (required, DATAFRAME) - your data.
  • label_column_name (required, STRING) - the column whose values become the slice labels.
  • data_column_name (required, STRING) - the numeric column whose values size the slices.
  • title (required, STRING, default empty) - the chart title.
  • IMAGE output - into Preview Image or Save Image.

When you'd reach for it

Proportion questions: share of total sales by category, breakdown of a column's value counts. The classic companion is Pandas Value Counts - count how often each value appears, feed that frame in with the values as data and the categories as labels, and you've got a distribution pie. It's also the natural endpoint for a Pandas Group By with a count or sum aggregation.

A word of honesty: pies get a bad rap, and for comparing many slices a bar chart is usually the better read. But for "here's the big slice" storytelling - three or four categories - a pie is unbeatable, and this node makes it a one-step operation.

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, seaborn, scipy, scikit-learn, openpyxl, lxml. No GPU - CPU-side Matplotlib rendering. PyTorch nodes moved to ComfyUI-Pt-Wrapper in March 2025.

Gotchas

  • Numeric data column only. Slices are sized by numbers; feed it a text column and Matplotlib will choke.
  • Too many slices = unreadable pie. If your labels column has a dozen unique values, aggregate first or switch to MPL Bar.
  • No axis-label inputs here. This node takes only a title - a pie doesn't need x/y labels, but don't go hunting for fields that don't exist.
CategoryData Analysis

Inputs (4)

NameTypeDefaultDescription
dataframeDATAFRAME
label_column_nameSTRING
data_column_nameSTRING
titleSTRING

Outputs (1)

NameTypeDescription
IMAGEIMAGE