library(ggplot2)
series <- data.frame(
time = c(rep(1, 4),rep(2, 4), rep(3, 4), rep(4, 4)),
type = c(1984:1987),
value = rpois(16, 10)
)
series %>%
ggplot(aes(time, value, group=factor(type, levels=1987:1984)))+
geom_col(aes(fill= factor(type)))+
guides(fill=guide_legend(title="type"))
I want to reorder the order of the fill between different groups, like the figure below that I have edited in Paint. How can I do that?