Skip to content

Instantly share code, notes, and snippets.

@jeroen
Created January 14, 2020 12:52
Show Gist options
  • Save jeroen/95e56b28461f5fb0feb5a27f686cd241 to your computer and use it in GitHub Desktop.
Save jeroen/95e56b28461f5fb0feb5a27f686cd241 to your computer and use it in GitHub Desktop.
Benchmark graphics devices for image()
plot_x <- function(x){
x11()
image(x)
dev.off()
}
plot_png <- function(x){
png(width = 800, height = 600)
image(x)
dev.off()
}
x <- matrix(rnorm(2e6), 1e3)
bench::mark(
x11 = plot_x(x),
png = plot_png(x)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment