Created
January 7, 2021 22:18
-
-
Save timedreamer/eee213cca917bdf35fb0b24f8cb6932d to your computer and use it in GitHub Desktop.
Save pheatmap figure into 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
# An R function to save pheatmap figure into pdf | |
# This was copied from Stackflow: https://stackoverflow.com/questions/43051525/how-to-draw-pheatmap-plot-to-screen-and-also-save-to-file | |
save_pheatmap_pdf <- function(x, filename, width=7, height=7) { | |
stopifnot(!missing(x)) | |
stopifnot(!missing(filename)) | |
pdf(filename, width=width, height=height) | |
grid::grid.newpage() | |
grid::grid.draw(x$gtable) | |
dev.off() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment