plot_waffle_chart()

Plots a multi-category waffle chart (10×10 dot grids) in the Economist style. Best for displaying precise grid proportions — “X out of 100” — in a visually striking format.

Quick Example

import pandas as pd
import clean_charts as cc

df = pd.DataFrame({
    "Heading": ["Growth Focus", "Resource Allocation", "Customer Centricity"],
    "Description": [
        "Organizations focusing 30% or more of their time on long-term growth initiatives",
        "Companies that actively increase resourcing during periods of market volatility",
        "Firms that consistently incorporate direct customer input into business decisions"
    ],
    "Value": [29, 30, 15]
})

cc.plot_waffle_chart(
    data=df,
    height=500,
    title="Key Strategic Priorities",
    subtitle="Percentage of surveyed organizations reporting on key focus areas",
    value_suffix="%"
)
Waffle
Example output for Waffle.

Data Requirements

  • 2 columns — [Category, Percentage]
  • 3 columns — [Label (optional grouping), Category, Percentage]

Parameters

Parameter Type Default Scope Description
datapd.DataFrameBuilt-inCommon2 or 3-column DataFrame.
output_pathstr | NoneNoneCommonFile path to save.
widthint | NoneAutoCommonImage width in pixels.
heightint | NoneAutoCommonImage height in pixels.
aspect_ratiostr | NoneNoneCommon"square", "landscape", etc.
titlestr | NoneNoneCommonBold header text.
subtitlestr | NoneNoneCommonSecondary text.
bg_colorstr | None"#f4f3f0"CommonBackground hex color.
scale_textboolTrueCommonScale fonts proportionally.
colorstr"#000000"UniqueHex color for filled dots.
inactive_colorstrLight grayUniqueHex color for unfilled dots.

Common Scenarios

Budget Allocation

df = pd.DataFrame({
    "Department": ["Manufacturing", "Engineering", "Operations", "Sales"],
    "Training Requirement": [
        "Heavy machinery and floor safety protocols",
        "Laboratory and electrical hazard compliance",
        "Logistics, warehouse, and lifting safety",
        "Standard office compliance and cybersecurity"
    ],
    "Completion (%)": [82, 94, 76, 98]
})

cc.plot_waffle_chart(
    data=df,
    title="Departmental Safety & Compliance Training",
    subtitle="Share of employees who have completed required annual certifications",
    value_suffix="%",
    color="#0066cc",          # Custom filled dot color (optional)
)
Waffle
Example output for Waffle.