Created
October 31, 2018 16:43
-
-
Save HenrikBengtsson/15aa30f9ed7b10875f411ad0bf94f2b7 to your computer and use it in GitHub Desktop.
This file contains 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) | |
dd <- data.frame(x = rnorm(5e5), y = rnorm(5e5)) | |
gg <- ggplot(dd, aes(x,y)) + geom_point() | |
## Render directively | |
t0 <- system.time(print(gg)) | |
print(t0) | |
# user system elapsed | |
# 7.013 0.046 7.094 | |
## Record plot | |
t1 <- system.time(pp <- R.devices::capturePlot(print(gg))) | |
print(t1) | |
# user system elapsed | |
# 2.093 0.060 2.154 | |
## Replay recorded plot | |
t2 <- system.time(print(pp)) | |
print(t2) | |
# user system elapsed | |
# 6.156 0.004 6.164 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment