Skip to content

Instantly share code, notes, and snippets.

@conorsg
Created March 2, 2015 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conorsg/54f99d46206301f74169 to your computer and use it in GitHub Desktop.
Save conorsg/54f99d46206301f74169 to your computer and use it in GitHub Desktop.
buildChart <- function(p) {
gt <- ggplot_gtable(ggplot_build(p))
t <- gtable_filter(gt, "title")[[1]]
l <- gtable_filter(gt, "guide-box")[[1]]
p <- p + theme(legend.position = "none", plot.title = element_blank())
built <- grid.arrange(
arrangeGrob(
t[[1]],
l[[1]],
p,
nrow = 3,
heights = c(1, 1.2, 10)
)
)
return(built)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment