I have a simple bargraph like
a<-data.frame(x=c("total","male","female","low education",
"mid education","high education","working","not working"),
y=c(80,30,50,20,40,20,65,35))
a$x<-as.character(a$x)
a$x<-factor(a$x,levels=unique(a$x))
ggplot(a,aes(x,y)) +
geom_bar(stat="identity",fill="orange",width=0.4) +
coord_flip() +
theme_bw()
Now, since the x-axis levels (inverted and now seem y) are related to each other, for example, men and women are disaggregated by sex, working and not working, are another breakdown, etc., I want the axis left some space between each breakdown to indicate these failures.
I tried some things with scale_x_discreteand its parameter crashed, but it seems that it is not. Any ideas?
source
share