Skip to content

Instantly share code, notes, and snippets.

@ajokela
Forked from sheymann/export_plot.R
Created April 20, 2013 21:17
Show Gist options
  • Save ajokela/5427469 to your computer and use it in GitHub Desktop.
Save ajokela/5427469 to your computer and use it in GitHub Desktop.
ExportPlot <- function(gplot, filename, width=2, height=1.5) {
# Export plot in PDF and EPS.
# Notice that A4: width=11.69, height=8.27
ggsave(paste(filename, '.pdf', sep=""), gplot, width = width, height = height)
postscript(file = paste(filename, '.eps', sep=""), width = width, height = height)
print(gplot)
dev.off()
png(file = paste(filename, '_.png', sep=""), width = width * 100, height = height * 100)
print(gplot)
dev.off()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment