Graphics Reference
In-Depth Information
See Also
For more on using colors in bar graphs, see
Using Colors in a Bar Graph
.
To reorder the levels of a factor based on the values of another variable, see
Changing the Order
Making a Bar Graph of Counts
Problem
Your data has one row representing each case, and you want plot counts of the cases.
Solution
ggplot(diamonds, aes(x
=
cut))
+
geom_bar()
# Equivalent to using geom_bar(stat="bin")