Field note · August 3, 2024
The category that eats the chart
2 values with 50.0% concentrated in one of them, and what that does to every chart downstream.
arm on clinical-trial has 2 values, and one of them is 50.0% of the data.
placebo— 450 rows, 50.0%treatment— 450 rows, 50.0%
The top three take 100.0% between them. With only 2 values there is no tail to worry about, which makes this a genuinely easy column to chart.
select arm,
count(*) as rows,
round(100.0 * count(*) / sum(count(*)) over (), 1) as pct,
round(avg(baseline_score)::numeric, 2) as avg_baseline_score
from clinical_trial
group by 1
order by rows desc;The second column is the one that matters. Share of rows tells you what is common; avg_baseline_score 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.