Use two positions and one area measure without letting radius scaling, overlap or missing records distort the comparison.
Bubble charts: scale the third measure by area
Three measures require three separate contracts
A bubble chart is a scatterplot whose marker area carries another nonnegative quantity. Position answers two questions; size answers a third. In an operations review, horizontal position could be median minutes to close a ticket, vertical position the fraction that breached a service target, and circle area the number of open tickets. Those measures come from different aggregations, so write the population and period beside each one. A depot with no measured closure time does not belong at zero minutes. Keep it in an excluded-record table instead of placing it at the origin. Likewise, a zero open-ticket count can be represented as a zero-area mark in the source table, but it cannot be selected on a chart. Show the count in an adjacent row or give zero-count depots a clearly labeled outline symbol with a fixed visual size that is not part of the area scale. Encoding choice and grain should be settled before selecting colors.
Area, not diameter, carries volume
A circle's area grows with the square of its diameter. Setting diameter directly proportional to a count makes 81 tickets look nine times wider and 81 times larger than nine tickets, despite a true ninefold count difference. To make area proportional to count, set diameter to a fixed maximum diameter times the square root of count divided by the maximum count. In the worked ledger, depots with nine, 36 and 81 open tickets receive diameters of 12, 24 and 36 pixels when the largest bubble is 36 pixels wide. Their areas then have the same 1:4:9 ratio as their counts. A plotting library may accept area in points squared instead of diameter in pixels; inspect that API rather than applying the square root twice. Display at least two labeled reference circles and the actual numeric value on focus or in a table. Proportional map symbols face the same area problem.
Overlap can erase the observation that matters
Large bubbles drawn last can hide smaller ones at nearly identical coordinates. Sort by descending size before drawing so smaller circles remain on top, add a visible stroke, and use moderate transparency only if overlapping colors have a meaningful legend. Transparency alone does not reveal every record when several points coincide. Offer a list of the observations at the selected coordinate, and preserve stable depot IDs in that list. Do not jitter either quantitative axis unless the adjustment is disclosed and the original values are still available. For dense data, switch to a hexbin or density view for the first scan, then open the original bubbles through a filter. A third encoded variable adds visual load; a fourth color measure should be used only when it answers an explicit question. Overplotting and hexbins explain the fallback.
Freeze the comparison frame
When two periods are placed side by side, keep the horizontal range, vertical range and maximum-bubble reference the same. Rescaling each panel independently can make a decline in ticket volume look like no change at all. The chart must state whether the size measure is a count, rate or monetary total; negative quantities cannot use an ordinary area scale without a separate sign channel. If a filter removes the largest depot, retain the original size reference when the user is comparing filtered and unfiltered views. Supply an accessible table with depot, both positional measures, ticket count and exclusion reason. If the story is primarily about count rank, bars will usually be faster to read than circles. Shared-scale panels, keyboard access and export contracts cover the handoff.
Worked contract
from math import isfinite, sqrt
def prepare_depot_bubbles(depot_rows, maximum_diameter=36):
if (not depot_rows or isinstance(maximum_diameter, bool) or
not isinstance(maximum_diameter, (int, float)) or
not isfinite(maximum_diameter) or maximum_diameter <= 0):
raise ValueError("rows and a positive maximum diameter are required")
known = set()
for depot, close_minutes, breach_fraction, open_tickets in depot_rows:
if not depot or depot in known:
raise ValueError("depot IDs must be unique")
known.add(depot)
if (any(isinstance(value, bool) or not isinstance(value, (int, float))
or not isfinite(value) for value in (close_minutes, breach_fraction)) or
close_minutes < 0 or not 0 <= breach_fraction <= 1 or
isinstance(open_tickets, bool) or not isinstance(open_tickets, int) or
open_tickets < 0):
raise ValueError("invalid depot measures")
maximum_count = max(row[3] for row in depot_rows)
if maximum_count == 0:
raise ValueError("all zero counts need a different chart")
marks = []
for depot, close_minutes, breach_fraction, open_tickets in depot_rows:
diameter = maximum_diameter * sqrt(open_tickets / maximum_count)
marks.append((depot, close_minutes, breach_fraction,
open_tickets, round(diameter, 2)))
return sorted(marks, key=lambda mark: (-mark[3], mark[0]))
depots = [("Harbor", 31, 0.12, 9),
("Ridge", 47, 0.19, 36),
("Canal", 54, 0.27, 81)]
marks = prepare_depot_bubbles(depots)
assert [(mark[0], mark[4]) for mark in marks] == [
("Canal", 36.0), ("Ridge", 24.0), ("Harbor", 12.0)]
assert 81 / 9 == (36 / 12) ** 2Performance and operating cost
For N depots, validation, maximum-count lookup and diameter calculation take O(N) time. Sorting by count for a deliberate draw order takes O(N log N) time and O(N) output space. This preparation does not solve geometric overlap; a naive pairwise collision test takes O(N²), so large interactive charts should use spatial indexing or aggregate to a density view. The size reference is computed once from the full comparison set, then held fixed across related panels and filters. Rendering libraries differ on whether their size parameter means area, radius or diameter, so test the displayed reference circles against the numeric contract.
Common Mistakes
- Setting circle diameter directly proportional to count and exaggerating area differences.
- Changing the largest-circle reference separately for each comparison panel.
- Using missing x or y measurements as zero and placing records at the origin.
- Hiding coincident points behind a large opaque marker with no accessible record list.
- Adding color as a fourth measure without a question, legend or readable alternative.
Validation drill
Prepare a depot review with 47 locations. Choose one period and one grain, hold the area reference fixed across two panels, then verify that a depot with four times another depot's count has twice its diameter rather than four times its diameter.
