I have a plot on a white background with grey facets and white facet text:
ggplot(data = data.frame(x = rep(1:2, 2), y = rep(1:2,2), color = c("Ap", "Ap", "B", "B")),
aes(x = x, y = y, color = color)) +
geom_point() +
facet_grid(~color) +
theme(panel.background = element_blank(),
strip.text = element_text(color = "white", size = 23))
My problem is that descenders (p, g, q, j) cross the facet. I would like the strip background to have a margin around the text so that all glyphs in the facet text are always strictly within the facet rectangle. I can add newlines to the facet text color = c("Ap\n", "Ap\n", "B\n", "B\n")
but the margin is too excessive (or the lineheight
required is too ugly). Is there a ggplot2
solution to this?