A bar chart where each bar’s length shows a group’s value.
barplot(height, names, horiz = TRUE)
Key idea
A bar chart is a picture that compares amounts across separate groups (called categories). (e.g. Apples 12, Bananas 9, Pears 5)
Bar length or height shows how big each value is.
Bars have gaps between them because the categories are separate things.
It makes it easy to rank categories from largest to smallest.
Unlike a histogram, the bottom axis shows labels, not number ranges.
In plain words
One bar per group, lined up so you can compare how long they are. Turn them on their sides when the names are long or you just want to see who is winning.
Where you'd use it
Four products sold 120, 90, 60, 30 units. A barplot draws four bars from the same baseline, so the longest bar (120) immediately shows your best seller and the ranking of the rest.
Three candidates got 4500, 3200, and 1800 votes. Bars side by side make the lead easy to read — the winner’s bar is roughly 2.5 times the length of the smallest.
To compare yearly rainfall across five cities, a bar each lets you spot the wettest and driest at a glance, far clearer than a pie when the values are close together.
Worked example 1
How happy players are with each type, out of 100: Sports 99, Strategy 90, Action 85, Shooter 95, Other 80. Bars on their sides make the order easy to see — Sports is on top.