From ggplot2's reference manual, of label_both
:
library(ggplot2)
mtcars$cyl2 <- factor(mtcars$cyl, labels = c("alpha", "beta", "gamma"))
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
# Displaying both the values and the variables
p + facet_grid(. ~ cyl, labeller = label_both)
This will give us facet strips with both variable name and its values. However, say if I want to change the appearance of the variable name, but not change the values, e.g.:
expression(italic(cyl))
So that I can get a cyl: 4 instead of cyl: 4, is it possible to do it using the labeller function?