I would appreciate your help in the following: I'm trying to build a stacked barplot. The fill is the split of business (new and renewed), the Y axis is volume of new/renewed business and the X would be the month. In my data I have two years of history, so I would like to have two stacked columns per month, one for n-1 year and one for n year. However, I don't know how to do this last step...
To clarify, please find below a picture of the data, the plot I have so far and a drawing of my goal.
And here is the code:
ggplot(BUSINESS, aes(fill=Business, y=GWP_mio, x=Date)) +
geom_bar(position="stack", stat="identity") +
scale_fill_manual(values = c("#009E73","Darkblue")) +
scale_y_continuous(breaks=seq(0,18000000,1000000), labels = scales::comma_format(scale = 1/1000000,
accuracy = .1), limits = c(0,18000000)) +
theme_ipsum() +
ggtitle('GWP development') +
theme(plot.title = element_text(hjust=0.5, size=14, family="Calibri", face="bold"),
legend.title = element_text(size=11, family="Calibri", face="bold"),
axis.title.x = element_text(hjust=1, size=11, family="Calibri", face="bold"),
axis.text.x = element_text(angle=90, hjust=1, size=11, family="Calibri"),
axis.title.y = element_text(angle=0, hjust=1, size=10, family="Calibri", face="bold"))
Any help would be highly appreciated.