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.002 0 0.002 #> 2 build 0.015 0 0.015 #> 3 render 0.022 0 0.023 #> 4 draw 0.028 0 0.028 #> 5 TOTAL 0.067 0 0.068
benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_grid(. ~ cyl))
#> step user.self sys.self elapsed #> 1 construct 0.002 0 0.003 #> 2 build 0.032 0 0.033 #> 3 render 0.062 0 0.062 #> 4 draw 0.048 0 0.047 #> 5 TOTAL 0.144 0 0.145
# With tidy eval: p <- expr(ggplot(mtcars, aes(mpg, wt)) + geom_point()) benchplot(!!p)
#> step user.self sys.self elapsed #> 1 construct 0.002 0.000 0.002 #> 2 build 0.015 0.000 0.015 #> 3 render 0.022 0.000 0.022 #> 4 draw 0.029 0.001 0.029 #> 5 TOTAL 0.068 0.001 0.068