Skip to contents

Autoplot method for timemoir results (grouped bar chart)

Usage

autoplot.timemoir(object, unit_memory = c("MB", "GB"), ...)

# S3 method for class 'timemoir'
plot(x, unit_memory = c("MB", "GB"), ..., y)

Arguments

object

A result from timemoir()

unit_memory

unit for memory display: "MB" or "GB" (default to "MB")

...

unused

x

A timemoir object.

y

Ignored, required for compatibility with the plot() generic.

Value

A ggplot object with grouped bars (duration, memory, cpu)

Details

This function requires some optional dependencies. ggplot2, tidyr, and dplyr.

Examples

test_function <- function(n) {
  x <- rnorm(n)
  mean(x)
}

res <- timemoir(test_function(1.2e7), test_function(1.5e7), test_function(1e7))
#> 
#> 
#> 

if (require(ggplot2) && require(tidyr) && require(dplyr)) {
  plot(res)
}
#> Loading required package: ggplot2
#> Loading required package: tidyr
#> Loading required package: dplyr
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union