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.012 0 0.011 #> 3 render 0.032 0 0.032 #> 4 draw 0.045 0 0.045 #> 5 TOTAL 0.091 0 0.090
benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_grid(. ~ cyl))
#> step user.self sys.self elapsed #> 1 construct 0.003 0 0.002 #> 2 build 0.025 0 0.024 #> 3 render 0.071 0 0.071 #> 4 draw 0.052 0 0.053 #> 5 TOTAL 0.151 0 0.150
# 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 0.003 #> 2 build 0.011 0 0.012 #> 3 render 0.035 0 0.036 #> 4 draw 0.033 0 0.032 #> 5 TOTAL 0.081 0 0.083