I want to set different colors for each strip.text.x
in a facet_grid
figure. I could find some Q&As about assigning different colors for strip.background
, but could not see one for texts.
In the example shown below, the x-axis strip texts are '4', '5', '6', and '7'. What I want is, for example, assigning the red color for '4', the blue one for '5', and some other colors on the other texts. Does anybody happen to know how to do this?
I tried to change them via using g <- ggplot_gtable(ggplot_build(p2))
, but it feels like I can only change the options of 'background rectangles' of the strips, not the texts themselves.
p2 <- ggplot(mpg, aes(displ, cty)) + geom_point() + facet_grid(drv ~ cyl)