I do not know how to change axial gaps and ranges of individual faces in a grunge plot. However, another option is to create separate graphics for each level of variable cut, and then lay out all the graphics together. Creating each plot individually allows you to have finer control over axial gaps and ranges for each plot.
mtcars:
library(scales)
library(grid)
library(gridExtra)
library(cowplot)
, cyl. scale_y_continuous y . . , .
pl = lapply(sort(unique(mtcars$cyl)), function(i) {
p = ggplot(mtcars[mtcars$cyl==i, ], aes(wt, mpg)) +
facet_wrap(~cyl) +
geom_point() +
labs(x="Weight", y="") +
scale_y_continuous(limits=c(ifelse(i==4, 10, 0), 1.1 * max(mtcars$mpg[mtcars$cyl==i])),
breaks=pretty_breaks(ifelse(i==6, 6, 3))) +
scale_x_continuous(limits=range(mtcars$wt)) +
theme(plot.margin=unit(c(0, 0.1, 0, -1),"lines"))
if(i < max(mtcars$cyl)) p = p + theme(axis.text.x=element_blank(),
axis.title.x=element_blank())
return(p)
})
. y.
grid.arrange(textGrob("MPG", rot=90), plot_grid(plotlist=pl, ncol=1, align="h"),
widths=c(0.03,0.97), ncol=2)
