I want to add general labels to facets in ggplot2. My code looks like this:
library(ggplot2)
df <- data.frame(x= 1:100, y= 1:100,
sport= rep(c(TRUE, FALSE), each= 50),
female= rep(c(TRUE, FALSE)))
ggplot(df, aes(x, y)) +
geom_point() +
facet_grid(female ~ sport)
And the plot I get is:
As you can see the labels are not informative at all. How can I add general lebals in facets? Here, it is sport
and female
.
There is already a similiar question but the answer does not work with the current ggplot2 3.3.0 version.