We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Firefox.

Stacked bar charts

ggplot(___) + 
    mapping = aes(x = ___, y = ___, 
                  fill = ___)
View Interactive Version

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))