blob: 400746d17a5cc2e461a12bfadd3641c158c85c60 [file] [log] [blame]
Hao Zhuf1860232020-08-23 23:53:11 -04001mini_hist <- function(x, width = 60, height = 20,
2 dir = "kableExtra", file = NULL,
3 xaxt = 'n', yaxt = 'n', ann = FALSE, col = "gray",
4 ...) {
5 if (!dir.exists(dir)) {
6 dir.create(dir)
7 }
8
9 if (is.null(file)) {
10 file <- tempfile("hist", dir, ".png")
11 }
12
13 grDevices::png(filename = file, width = width, height = height,
14 bg = 'transparent')
15 graphics::par(mar = c(0, 0, 0, 0))
16 graphics::hist(x, xaxt = xaxt, yaxt = yaxt, ann = ann, col = col, ...)
17 grDevices::dev.off()
18 return(file)
19}