Here’s an alternative take using faceting instead of dodging:
ggplot(df, aes(x = year, y = total, fill = type)) +
geom_bar(position = "stack", stat = "identity") +
facet_wrap( ~ treatment)
With Tyler’s suggested change: + theme(panel.margin = grid::unit(-1.25, "lines"))