Stacked bar charts
View Interactive Version
ggplot(___) + geom_col( mapping = aes(x = ___, y = ___, fill = ___) )
In some circumstances it might be useful to plot multiple numeric values variables within each bar. Examples are numeric values describing one specific entity (e.g. customers) split among various categories (customer segments) so that the bar height represents the total number (all customers).
The plot below shows the number of phones (in thousands) by continent from 1956 to 1961 as a stacked bar chart:
ggplot(world_phones) + geom_col(aes(x = year, y = phones, fill = region))