stacked bars within grouped bar chart

You can put cat on the x-axis and use facet_grid with year:

ggplot() +
  geom_bar(data=test, aes(y = value, x = cat, fill = cond), stat="identity",
           position='stack') +
  theme_bw() + 
  facet_grid( ~ year)

enter image description here

Leave a Comment