Created
December 13, 2017 23:08
-
-
Save econandrew/4fd9d61397b467ffbfd4d4d4ba6fb5f6 to your computer and use it in GitHub Desktop.
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
library(ggplot2) | |
p <- ggplot(mtcars, aes(cyl, mpg)) + geom_point() | |
res <- 300 | |
fn <- "test.png" | |
# Default png() | |
png(fn, res = res) | |
print(p) | |
dev.off() | |
system(paste0('identify -format "%x x %y" ', fn)) | |
# quartz | |
png(fn, type = "quartz", res = res) | |
print(p) | |
dev.off() | |
system(paste0('identify -format "%x x %y" ', fn)) | |
# cairo | |
png(fn, type = "cairo", res = res) | |
print(p) | |
dev.off() | |
system(paste0('identify -format "%x x %y" ', fn)) | |
# cairo-png | |
png(fn, type = "cairo-png", res = res) | |
print(p) | |
dev.off() | |
system(paste0('identify -format "%x x %y" ', fn)) | |
# CairoPNG | |
Cairo::CairoPNG(fn, res = res) | |
print(p) | |
dev.off() | |
system(paste0('identify -format "%x x %y" ', fn)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment