Is there a way to have a little separation between each group bars made with grouped bar_plot()? Like having a bigger distance between different groups and small distance inside group bars, but not sticked one another.
Here the whole code:
### my DF generation
df.bar <- as.data.frame( cbind(
"diagnosis" = rep( names_DX, 2 ) ,
"number" = as.numeric(c(9,18,43,8,34,12,3,7,38,12,8,6)),
"status" = c(1,1,1,1,1,1,0,0,0,0,0,0)
))
df.bar$diagnosis <- factor(df.bar$diagnosis,levels(df.bar$diagnosis)[c(1,5,6,2:4)]) #reorder levels for plot
### plot generation
p <- ggplot(data = df.bar, aes(x = diagnosis, y = as.numeric(as.character(number)), fill = factor(status) )) +
geom_bar(stat = "identity", position=position_dodge())+
theme_bw()
my result:
what I'd like to get (ignore colors difference etc, only for the bars positions):
Thanks in advance for any help!


