For ggplot v2.2.0 V themespecify the fields in the element strip_text(see here )
size = 26
library(ggplot2)
library(grid)
p = 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_bw() +
theme(strip.text = element_text(color = "white", size = size))
p +
theme(strip.text.x = element_text(margin = margin(.1, 0, .3, 0, "cm")))
ggplot . , , unit(1, "cm"), , , , .
: ggplot2 2.0.0
: 3.0.0 grid:::unit.list() .
size = 26
library(ggplot2)
library(grid)
p = 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_bw() +
theme(strip.text = element_text(color = "white", size = size))
g <- ggplotGrob(p)
g$heights[3] = unit(2, "grobheight", textGrob("a", gp=gpar(fontsize = size)))
grid.newpage()
grid.draw(g)
