- library(ggplot2)
- library(gridExtra)
- library(grid)
- # Create dummy variable to facet on: this name will appear in the strip
- mtcars$tempvar <- "Market Updates"
- # Basic plot
- # Manually added legend to match your expected result
- p <- ggplot(mtcars, aes(mpg, wt)) +
- geom_line() + labs(x = "Date", y = "High") + facet_grid(. ~ tempvar) +
- theme(strip.background = element_rect(fill="gray"),
- strip.text = element_text(size=15))
- p