Skip to content

Instantly share code, notes, and snippets.

@hrbrmstr
Created June 9, 2018 22:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrbrmstr/86fb5284178f1a87248929bb719a2bd4 to your computer and use it in GitHub Desktop.
Save hrbrmstr/86fb5284178f1a87248929bb719a2bd4 to your computer and use it in GitHub Desktop.
library(grid)
library(hrbrthemes)
library(tidyverse)
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
labs(title = "A Title", subtitle = "A Subtitle") +
theme_ipsum_rc(grid="XY") -> gg
gb <- ggplot_build(gg)
gt <- ggplot_gtable(gb)
gt$layout$l[gt$layout$name %in% c("title", "subtitle")] <- 2
grid.newpage()
grid.draw(gt)
@mjahanshahi
Copy link

This is wonderful. Thanks Bob!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment