Skip to content

Instantly share code, notes, and snippets.

View chansigit's full-sized avatar
🏠
Working from home

Sijie Chen chansigit

🏠
Working from home
  • Stanford University
  • CA
View GitHub Profile
@chansigit
chansigit / save_pheatmap_pdf.R
Created October 10, 2022 10:23 — forked from timedreamer/save_pheatmap_pdf.R
Save pheatmap figure into pdf
# 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)