Field note · April 23, 2025

The category that eats the chart

4 values with 25.0% concentrated in one of them, and what that does to every chart downstream.

1 min read ·Visualization ·visualization practice

city on city-air-quality has 4 values, and one of them is 25.0% of the data.

  • Ashfield — 1,370 rows, 25.0%
  • Bellmoor — 1,370 rows, 25.0%
  • Corvallis Bay — 1,370 rows, 25.0%
  • Drayton — 1,370 rows, 25.0%

The top three take 75.0% between them. With only 4 values there is no tail to worry about, which makes this a genuinely easy column to chart.

sql
select city,
       count(*)                                      as rows,
       round(100.0 * count(*) / sum(count(*)) over (), 1) as pct,
       round(avg(pm25)::numeric, 2)             as avg_pm25
from city_air_quality
group by 1
order by rows desc;

The second column is the one that matters. Share of rows tells you what is common; avg_pm25 tells you whether the common thing is the important thing. They disagree more often than not, and a chart that shows only the first is answering the easier question.

Decide what happens to the tail before you plot it. "Other" as an explicit bucket is honest; twelve slivers is not, and neither is silently taking the top eight.