I created a horizontal boxplot in ggplot2 (de-identified image below). What I'm trying to figure out is a way to reduce the size of the space on the y-axis (which is really the discrete x-axis), i.e. the height of the space from the top to "label1" and the same space at the bottom. I haven't had any luck so far. It looks like the axis goes from about 0 to 3 or so, with the lower box from 0.5-1.5 and the upper box from 1.5-2.5. If that's the case, I'd like the axis to go from about 0.3-2.7.
ggplot(box,aes(X_NAME_,COL1))+geom_boxplot()+
labs(y=NULL,x=NULL)+
stat_summary(fun.y=mean,geom='point')+theme_classic()+
annotate('text',y=4,x=2.5,label='label1')+
annotate('text',y=-2.25,x=1.5,label='label2')+
scale_x_discrete(labels=NULL)+theme(axis.ticks.y=element_blank())+
theme(axis.line.y=element_blank())+
scale_y_continuous(limits=c(-40,40))+
annotate('rect',xmin=0,xmax=3,ymin=-40,ymax=0, alpha=0.1)+
annotate('rect',xmin=0,xmax=3,ymin=0,ymax=40, alpha=0.3)+
coord_flip()
