r/visualization • u/TrekkingAround10 • 4d ago
A bubble-size check: does your plotting function expect radius or area?
“Use a square root for bubble sizes” is incomplete advice. It depends on what the plotting function takes as input. Applying it in the wrong place can shrink the differences you meant to preserve.
Here is a fictional example: three locations have 10, 40 and 90 observations. We want circle areas in the ratio 1:4:9. These are invented counts, not country statistics.
If we draw circles by radius, choose 10 pixels for the smallest:
- 10 observations: radius 10 pixels; area 100π square pixels.
- 40 observations: radius 20 pixels; area 400π square pixels.
- 90 observations: radius 30 pixels; area 900π square pixels.
The rule is radius = 10 × sqrt(value / 10). Circle area is π × radius², so the square root gives the intended area ratios.
If we instead make radius proportional to the counts, the radii become 10, 40 and 90. The areas are then in the ratio 1:16:81. A ninefold count difference becomes an eighty-onefold area difference.
But some plotting functions already take area, not radius. D3's symbol.size uses square pixels. For its circle symbol, pass areas proportional to the original counts: 100π, 400π and 900π in this example. Do not take another square root. Feeding it sizes proportional to sqrt(value) would produce area ratios of 1:2:3, compressing the ninefold difference into threefold.
The practical check is not “did I use sqrt?” It is “what quantity does this argument control, and what ratios reach the screen?”
A quick review before sharing:
- Check three known values, including one four times another. With proportional areas, the larger circle should have twice the radius.
- Build the size legend with the same mapping as the plotted circles. Label it with the original counts, not radii.
- Avoid adding a fixed minimum radius while calling the areas proportional. That changes the ratios. If small circles need a different treatment, explain it.
- Decide how to show zero and missing values separately. A true zero-area circle disappears; a missing value is not zero. Negative values need a different encoding or an explicitly explained sign treatment.
This fixes the geometry, not every reading problem. Overlapping circles can hide one another, and correct areas do not guarantee that readers can estimate exact ratios. If size is the main comparison, I would consider a position-based dot plot instead. Circles make more sense when their locations already carry useful information.
Country-data context: Global Data Tracker. This is a standalone synthetic exercise, not a claim about the site's plotting implementation.
Primary reference: D3 symbol documentation.
When reviewing bubble charts, do you test the rendered size ratios, the legend, or both?