13A.15 Bar, col, counts, percent, and position
bar and col look similar but perform different calculations. With x only, bar counts rows at each category. With y, bar summarizes y using --summary-fun, default mean. col draws supplied y values and sums them when x repeats. This difference must be explicit in review.

The teaching count plot first applies distinct ID; otherwise every subject contributes nine records and the bars count records rather than subjects. It maps fill to SEX and uses position = "dodge" to place groups side by side.
--position stack adds categories vertically, dodge places them beside one another, fill scales every x total to one, and identity overlays them. --y-stat count, density, or percent changes the displayed statistic where applicable. A filled bar communicates composition but hides absolute N; pair it with counts or labels in a table.
For a y summary, available functions are mean, median, sum, min, max, n, sd, geomean, q1, and q3. A bar of means should not be described as a total, and a col plot of repeated observations should not be described as a mean.
Validate a categorical graphic against the frequency-table CSV. The exact category order, count, and denominator should agree. If the plot uses fill, inspect whether missing fill values disappear or form a category. When a stacked bar becomes difficult to compare, prefer a frequency table or faceted count plot over adding more colours.
Common mistakes
- Counting records when the question asks for subjects.
- Confusing bar-with-y means with col sums.
- Comparing fill-scaled bars without showing N.
- Using geometric mean when zeros or negatives are present.
Checklist
- Define the counting unit.
- Choose bar or col from the calculation required.
- State summary function and position.
- Verify denominators for percentages.
- Cross-check category counts with a frequency table.
Further reading
See frequency tables, summary geoms, row grain, and statistics.