blob: 84accc7b38ea1c3b661e417d5bc140c99eb2556c [file] [log] [blame]
Hao Zhu5fe235c2020-08-26 00:26:49 -04001% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/mini_plots.R
3\name{spec_hist}
4\alias{spec_hist}
Hao Zhu5fe235c2020-08-26 00:26:49 -04005\title{Helper functions to generate inline sparklines}
6\usage{
7spec_hist(
8 x,
9 width = 200,
10 height = 50,
11 res = 300,
12 breaks = "Sturges",
13 same_lim = TRUE,
14 lim = NULL,
15 xaxt = "n",
16 yaxt = "n",
17 ann = FALSE,
18 col = "lightgray",
19 border = NULL,
20 dir = if (is_latex()) rmd_files_dir() else tempdir(),
21 file = NULL,
Hao Zhu30db0272021-02-19 13:02:29 -050022 file_type = if (is_latex()) "pdf" else svglite::svglite,
Hao Zhu5fe235c2020-08-26 00:26:49 -040023 ...
24)
Hao Zhu5fe235c2020-08-26 00:26:49 -040025}
26\arguments{
27\item{x}{Vector of values or List of vectors of values.}
28
29\item{width}{The width of the plot in pixel}
30
31\item{height}{The height of the plot in pixel}
32
33\item{res}{The resolution of the plot. Default is 300.}
34
Hao Zhuf6b60e82020-10-21 18:58:19 -040035\item{breaks}{The \code{break} option in \code{hist}. Default is "Sturges" but you can
36also provide a vector to manually specify break points.}
37
Hao Zhu5fe235c2020-08-26 00:26:49 -040038\item{same_lim}{T/F. If x is a list of vectors, should all the plots be
39plotted in the same range? Default is True.}
40
Hao Zhudefd1892020-09-09 00:08:09 -040041\item{lim}{Manually specify plotting range in the form of
42\code{c(0, 10)}.}
Hao Zhu5fe235c2020-08-26 00:26:49 -040043
44\item{xaxt}{On/Off for xaxis text}
45
46\item{yaxt}{On/Off for yaxis text}
47
48\item{ann}{On/Off for annotations (titles and axis titles)}
49
50\item{col}{Color for the fill of the histogram bar/boxplot box.}
51
52\item{border}{Color for the border.}
53
54\item{dir}{Directory of where the images will be saved.}
55
56\item{file}{File name. If not provided, a random name will be used}
57
Bill Evans95a04282020-09-14 12:39:25 -070058\item{file_type}{Graphic device. Can be character (e.g., \code{"pdf"})
59or a graphics device function (\code{grDevices::pdf}). This defaults
60to \code{"pdf"} if the rendering is in LaTeX and \code{"svg"} otherwise.
Hao Zhu5fe235c2020-08-26 00:26:49 -040061for HTML output}
62
Hao Zhudefd1892020-09-09 00:08:09 -040063\item{...}{extra parameters sending to \code{hist()}}
Hao Zhu5fe235c2020-08-26 00:26:49 -040064}
65\description{
66These functions helps you quickly generate sets of sparkline
Bill Evans5a383e52020-08-30 20:09:52 -070067style plots using base R plotting system. Currently, we support histogram,
Hao Zhuf6b60e82020-10-21 18:58:19 -040068boxplot, line, scatter and pointrange plots. You can use them together with
69\code{column_spec} to generate inline plot in tables. By default, this function
70will save images in a folder called "kableExtra" and return the address of
71the file.
Hao Zhu5fe235c2020-08-26 00:26:49 -040072}