code of plot:
library(tidyverse)
mtcars %>%
ggplot(aes(factor(cyl), disp)) +
geom_col() +
facet_grid(. ~ gear, switch = "x") +
theme(
strip.placement = "outside",
strip.background = element_rect(fill = "white", color = "red")
)
I'm trying to modify the color of certain borders: Expected output:
I tried to change it using grobs but it seems that specific borders cannot be changed.
p <- mtcars %>%
ggplot(aes(factor(cyl), disp)) +
geom_col() +
facet_grid(. ~ gear, switch = "x") +
theme(
strip.placement = "outside",
strip.background = element_rect(fill = "white", color = "red")
)
g <- ggplotGrob(p)
g$grobs[[13]]$grobs[[1]]$children$strip.background.x..rect.33641$gp$col