r - What does autoplot.microbenchmark actually plot? -


according docs, microbenchmark:::autoplot "uses ggplot2 produce more legible graph of microbenchmark timings."

cool! let's try example code:

library("ggplot2") tm <- microbenchmark(rchisq(100, 0),                      rchisq(100, 1),                      rchisq(100, 2),                      rchisq(100, 3),                      rchisq(100, 5), times=1000l) autoplot(tm) 

microbenchmark plots

i don't see the...squishy undulations in documentation, best guess this answer function creator smoothed series of boxplots of time taken run, upper , lower quartiles connected on body of shape. maybe? these plots interesting not find out going on here.

what plot of?

the short answer violin plot:

it box plot rotated kernel density plot on each side.


the longer more interesting(?) answer. when call autoplot function, calling

## class(ts) microbenchmark autoplot.microbenchmark 

we can inspect actual function call via

r> gets3method("autoplot", "microbenchmark") function (object, ..., log = true, y_max = 1.05 * max(object$time))  {     y_min <- 0     object$ntime <- convert_to_unit(object$time, "t")     plt <- ggplot(object, ggplot2::aes_string(x = "expr", y = "ntime"))  ## ~6 lines or after 

the key line + stat_ydensity(). looking @ ?stat_ydensity come page on violin plots.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -