plot_bubble_matrix_chart()

Plots a bubble matrix chart. Best for visualizing 3 dimensions of data (Row, Column, Size) in a grid format — useful for skill assessments, risk matrices, and performance heatmaps.

Quick Example

import pandas as pd
import clean_charts as cc

df = pd.DataFrame({
    "Generation": ["Gen Z", "Millennials", "Gen X", "Boomers"],
    "TikTok":    [95, 60, 20,  5],
    "Instagram": [85, 90, 55, 15],
    "X / Twitter":[45, 65, 40, 10],
    "LinkedIn":  [15, 75, 80, 30],
    "Facebook":  [10, 65, 85, 90]
})

cc.plot_bubble_matrix_chart(
    data=df,
    title="Social Media Demographics",
    subtitle="Estimated daily active users (in millions) by generation",
    value_suffix="m", 
)

Bubble Matrix
Example output for Bubble Matrix.

Data Requirements

  • Column 0 — Row category labels (str)
  • Columns 1…N — Numeric values. Column headers become the column labels.

Parameters

Parameter Type Default Scope Description
datapd.DataFrameBuilt-inCommonFirst column: row labels. Remaining columns: numeric values.
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.
start_colorstr"#000000"UniqueGradient color for lowest-value bubbles.
end_colorstr"#2323FF"UniqueGradient color for highest-value bubbles.
show_valuesboolFalseUniquePrint numeric values inside each bubble.

Common Scenarios

Risk Matrix

df = pd.DataFrame({
    "Likelihood": ["Almost Certain", "Likely", "Possible", "Unlikely", "Rare"],
    "Negligible": [2, 5,  8, 12, 15],
    "Minor":      [1, 4, 10,  8,  5],
    "Moderate":   [0, 2,  6,  4,  2],
    "Major":      [0, 1,  2,  3,  1],
    "Severe":     [0, 0,  1,  1,  0]
})

cc.plot_bubble_matrix_chart(
    data=df,
    title="Enterprise Risk Assessment",
    subtitle="Volume of identified risks by Likelihood and Impact",
    show_values=True,
    end_color="#FFA896", 
    start_color="#9B1313"    
)
Bubble Matrix
Example output for Bubble Matrix.