Created
April 30, 2017 13:52
-
-
Save crsh/be88be19233f1df4542aca900501f0fb to your computer and use it in GitHub Desktop.
Plot only legend of a ggplot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stolen from http://stackoverflow.com/a/12041779/914024 | |
gglegend <- function(x){ | |
tmp <- ggplot_gtable(ggplot_build(x)) | |
leg <- which(sapply(tmp$grobs, function(y) y$name) == "guide-box") | |
tmp$grobs[[leg]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
stolen haha