Benchmark plot creation time. Broken down into construct, build, render and draw times.

benchplot(x)

Arguments

x

code to create ggplot2 plot

Examples

benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point())
#> step user.self sys.self elapsed #> 1 construct 0.004 0 0.005 #> 2 build 0.016 0 0.017 #> 3 render 0.044 0 0.043 #> 4 draw 0.036 0 0.036 #> 5 TOTAL 0.100 0 0.101
benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_grid(. ~ cyl))
#> step user.self sys.self elapsed #> 1 construct 0.004 0 0.003 #> 2 build 0.024 0 0.026 #> 3 render 0.092 0 0.093 #> 4 draw 0.060 0 0.061 #> 5 TOTAL 0.180 0 0.183
# With tidy eval: p <- expr(ggplot(mtcars, aes(mpg, wt)) + geom_point()) benchplot(!!p)
#> step user.self sys.self elapsed #> 1 construct 0.004 0 0.003 #> 2 build 0.016 0 0.015 #> 3 render 0.044 0 0.046 #> 4 draw 0.036 0 0.037 #> 5 TOTAL 0.100 0 0.101