I'm trying to get a nice display when having multiple variables on one dimension of my facet_grid
so that instead of repeating the name of all variables for each column (or row) I have a merged box over sub-boxes.
Taking a concrete example with a default dataset from R (based on the R Cookbook):
library(reshape2)
sp <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) +
geom_point(shape=1) +
facet_grid(smoker ~ sex+day)
sp
This returns something like the top part of this figure, with Female/Male being repeated at the top of each column. Is there a way (in R) of instead merging all the gender blocks to get something like the bottom part of the figure I uploaded? (I did this one with Gimp, needless to say it's not an ideal option)
I looked up the documentation for facet_grid
and it feels like the solution would be to create a new labeller function, but I'm just too new to R to be able to go for it. I've searched a bit more to see if someone had already solved this problem but didn't seem to find any answers.
Does anyone know of a custom labeller function that's been already created for that purpose, or does anyone know how to create such a custom labeller function? That would be just amazing.