Skip to content

Instantly share code, notes, and snippets.

@gkaramanis
Created March 31, 2021 20:52
Show Gist options
  • Save gkaramanis/b834127f3b77d62dc5ed16ecacc58e73 to your computer and use it in GitHub Desktop.
Save gkaramanis/b834127f3b77d62dc5ed16ecacc58e73 to your computer and use it in GitHub Desktop.
color behind title
library(ggplot2)
library(cowplot)
p <- ggplot(mtcars, aes(cyl, disp)) +
geom_point() +
labs(title = "But China and India") +
theme(
plot.background = element_rect(fill = "transparent")
)
ggdraw() +
draw_line(x = c(0.145, 0.195), y = c(0.97, 0.97), size = 8, color = "orange", lineend = "round") +
draw_line(x = c(0.287, 0.33), y = c(0.97, 0.97), size = 8, color = "darkslategray3", lineend = "round") +
draw_plot(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment