I would like to change the colours of the strip backgrounds to a predefined order.
This code generates the plot, and changes the strip backgrounds to red:
p <- ggplot(mpg, aes(displ, cty)) + geom_point() + facet_grid(. ~ cyl) +
theme(strip.background = element_rect(fill="red"))
I'd like to do something like the below however, which ideally would specify a different colour for each strip
p <- ggplot(mpg, aes(displ, cty)) + geom_point() + facet_grid(. ~ cyl) +
theme(strip.background = element_rect(fill=c("red","green","blue","yellow")))
Which just makes them all red...
This was asked in similar questions years ago, the answer was to manipulate grobs. I was hoping that there was a simpler solution in the years since?