plot_bubble_scatter_chart()

Plots a 3-variable bubble scatter plot where dot size encodes a third numeric dimension. Best for market sizing, portfolio analysis, and multi-dimensional comparisons.

Quick Example

import pandas as pd
import clean_charts as cc

df = pd.DataFrame({
    "State": ["CA", "TX", "FL", "NY", "IL", "PA", "OH", "GA", "NC", "MI"],
    "Cost of Living Index": [138, 92, 101, 134, 94, 98, 91, 89, 96, 90],
    "Median Income": [84, 67, 61, 75, 72, 67, 61, 65, 60, 63],
    "Population (M)": [39.0, 30.0, 22.2, 19.5, 12.5, 12.9, 11.7, 10.9, 10.6, 10.0]
})

cc.plot_bubble_scatter_chart(
    data=df,
    title="Economic Reality by State",
    subtitle="Cost of living vs Median Income. Bubble size = Population.",
    x_label="Cost of Living Index",
    y_label="Median Income",
    y_suffix="k", 
    show_labels=True,
    alpha=0.6 
)
Bubble Scatter
Example output for Bubble Scatter.

Data Requirements

  • 3 columns — [X, Y, Size]
  • 4 columns — [Label, X, Y, Size]

Parameters

Parameter Type Default Scope Description
datapd.DataFrameBuilt-inCommon3 or 4-column DataFrame.
output_pathstr | NoneNoneCommonFile path to save.
widthint | None700CommonImage width in pixels.
heightint | None500CommonImage 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.
min_bubble_sizefloat60UniqueMinimum bubble marker area in points².
max_bubble_sizefloat600UniqueMaximum bubble marker area in points².
start_colorstr | NoneNoneUniqueGradient start color for bubbles.
end_colorstr | NoneNoneUniqueGradient end color for bubbles.
colorstr | NoneNoneUniqueSingle color for all bubbles.
alphafloat0.7UniqueTransparency (0.0–1.0).
show_valuesboolFalseUniqueAnnotate bubbles with their size values.
show_labelsboolFalseUniqueAnnotate bubbles with label strings.
x_labelstr | NoneNoneUniqueX-axis label.
y_labelstr | NoneNoneUniqueY-axis label.