Bubble Charts
What is a bubble chart?
A bubble chart is a scatter plot where:
- x axis = metric 1
- y axis = metric 2
- bubble size = metric 3 (volume)
Example
Bubble chart
import pandas as pd
import plotly.express as px
df = pd.DataFrame({
"city": ["Pune", "Delhi", "Mumbai", "Bengaluru"],
"sales": [120, 180, 90, 160],
"profit": [30, 45, 10, 35],
"orders": [200, 350, 120, 280],
})
fig = px.scatter(
df,
x="sales",
y="profit",
size="orders",
color="city",
hover_name="city",
title="Sales vs Profit (bubble size = orders)",
)
fig.show()Bubble chart
import pandas as pd
import plotly.express as px
df = pd.DataFrame({
"city": ["Pune", "Delhi", "Mumbai", "Bengaluru"],
"sales": [120, 180, 90, 160],
"profit": [30, 45, 10, 35],
"orders": [200, 350, 120, 280],
})
fig = px.scatter(
df,
x="sales",
y="profit",
size="orders",
color="city",
hover_name="city",
title="Sales vs Profit (bubble size = orders)",
)
fig.show()Tips
- Keep sizes reasonable; very large bubbles hide others.
- Use hover tooltips to reduce label clutter.
If this helped you, consider buying me a coffee ☕
Buy me a coffeeWas this page helpful?
Let us know how we did
