Lets say I have a stacked barplot like below:
library(ggplot2)
dfr <- data.frame(x=1:5,y=c(4,6,2,3,6,8,3,6,8,4),
z=c("A","A","A","A","A","B","B","B","B","B"))
ggplot(dfr,aes(x=x,y=y,fill=z))+
geom_bar(stat="identity")
I would like to group 1 and 2 together, and group 3,4,5 together. My idea is to have a wider gap between 2 and 3. Is it possible to pass in a custom gap vector like c(2,4,2,2)
for the gaps. I do not want to use faceting for this purpose.