barplot() — Bar chart

A bar chart where each bar’s length shows a group’s value.

barplot(height, names, horiz = TRUE)

Key idea

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

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.

Frequently asked questions

Where should the bar axis start?
At zero — otherwise bar lengths mislead.