Created
April 10, 2016 21:27
-
-
Save jtilly/4aafe9d0a97279e347e7bea7e70151a2 to your computer and use it in GitHub Desktop.
Print graphs to screen and save them as Tikz or PDF
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
| print_graph = function(g, type = NULL, filename = NULL, height = 6, width = 6, path = ifelse(type == "tikz", "tex", "pdf")) { | |
| print(g) | |
| if(!is.null(type)) { | |
| if(type == "tikz") { | |
| tikz(paste0(path, "/", filename), height = height, width = width) | |
| print(g) | |
| dev.off() | |
| } | |
| if(type == "pdf") { | |
| pdf(paste0(path, "/", filename), height = height, width = width) | |
| print(g) | |
| dev.off() | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment