Create border and title for each column in `facet_wrap`
问题 I want to put black borders with labels and titles around each facet in facet_wrap . Something similar to this: Sample data: library(tidyverse) mtcars %>% mutate(gear = factor(gear, levels = c(4, 3, 5))) %>% ggplot(aes(mpg, disp)) + geom_point() + geom_smooth(method = "lm") + facet_wrap(~am + gear) 回答1: You can do this by manually adding to the ggplot gtable : library(tidyverse) library(grid) library(gtable) p <- mtcars %>% mutate(gear = factor(gear, levels = c(4, 3, 5))) %>% ggplot(aes(mpg,