Here is some example code:
# generate data
gdat <- data.frame(a = rep(LETTERS[1:10], 10), x = rnorm(100), y = rnorm(100))
# make plot with labels
g <- ggplot(gdat, aes(x = x, y = y)) + geom_point() + facet_wrap(~a)
# make plot without labels
g + theme(strip.background = element_blank(), strip.text = element_blank()
# returns an error:
Error in apply(strip_mat, 1, max_height) :
dim(X) must have a positive length
# stackoverflow answer:
g + theme(strip.background=element_blank(), strip.text=element_text(color="transparent"), panel.spacing.y=unit(-0.8, "lines"))
The StackOverflow response to the question is workable, but not particularly satisfying because it requires defining the space between plots with the `panel.spacing.y` option. This means that, if I am producing plots of different sizes, then I have to re-tune the spacing so things line up correctly.
I am curious whether anyone is aware of a solution to delete the facet strips while preserving the automatic spacing between the panels?
Previously, the facet strips would just be deleted and the spacing would be automatic, just as the x-spacing is set automatically. My script worked last time I ran it (~5 weeks ago) and I recently updated ggplot, so I am guessing this may be an unintended consequence of the upgrade. I am using ggplot 2.2.1.9000 and R v3.4.2.