Using facet tags and strip labels together in ggplot2

You can view the code for tag_facet here. As you can see, the function explicitly and deliberately removes the facet strips (see also the "value" in the documentation). You can fix that by creating your own function, and just removing the theme call from the original code:

tag_facet2 <- function(p, open = "(", close = ")", tag_pool = letters, x = -Inf, y = Inf, 
    hjust = -0.5, vjust = 1.5, fontface = 2, family = "", ...) {

    gb <- ggplot_build(p)
    lay <- gb$layout$layout
    tags <- cbind(lay, label = paste0(open, tag_pool[lay$PANEL], close), x = x, y = y)
    p + geom_text(data = tags, aes_string(x = "x", y = "y", label = "label"), ..., hjust = hjust, 
        vjust = vjust, fontface = fontface, family = family, inherit.aes = FALSE)
}

enter image description here


With {tagger} package, this can be made a little simpler. You can install tagger by using devtools::install_github("eliocamp/tagger"). After installing tagger, let's load it.

library(tagger)
library(ggplot2)

# Plot dummy data
p <- ggplot(mtcars, aes(mpg, wt)) 
p <- p + geom_point() 
p + facet_grid(gear ~ cyl) + tag_facets()

enter image description here