Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 1 | % 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 Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 5 | \title{Helper functions to generate inline sparklines} |
| 6 | \usage{ |
| 7 | spec_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, |
Bill Evans | 95a0428 | 2020-09-14 12:39:25 -0700 | [diff] [blame] | 22 | file_type = if (is_latex()) "pdf" else "svg", |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 23 | ... |
| 24 | ) |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 25 | } |
| 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 Zhu | f6b60e8 | 2020-10-21 18:58:19 -0400 | [diff] [blame] | 35 | \item{breaks}{The \code{break} option in \code{hist}. Default is "Sturges" but you can |
| 36 | also provide a vector to manually specify break points.} |
| 37 | |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 38 | \item{same_lim}{T/F. If x is a list of vectors, should all the plots be |
| 39 | plotted in the same range? Default is True.} |
| 40 | |
Hao Zhu | defd189 | 2020-09-09 00:08:09 -0400 | [diff] [blame] | 41 | \item{lim}{Manually specify plotting range in the form of |
| 42 | \code{c(0, 10)}.} |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 43 | |
| 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 Evans | 95a0428 | 2020-09-14 12:39:25 -0700 | [diff] [blame] | 58 | \item{file_type}{Graphic device. Can be character (e.g., \code{"pdf"}) |
| 59 | or a graphics device function (\code{grDevices::pdf}). This defaults |
| 60 | to \code{"pdf"} if the rendering is in LaTeX and \code{"svg"} otherwise. |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 61 | for HTML output} |
| 62 | |
Hao Zhu | defd189 | 2020-09-09 00:08:09 -0400 | [diff] [blame] | 63 | \item{...}{extra parameters sending to \code{hist()}} |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 64 | } |
| 65 | \description{ |
| 66 | These functions helps you quickly generate sets of sparkline |
Bill Evans | 5a383e5 | 2020-08-30 20:09:52 -0700 | [diff] [blame] | 67 | style plots using base R plotting system. Currently, we support histogram, |
Hao Zhu | f6b60e8 | 2020-10-21 18:58:19 -0400 | [diff] [blame] | 68 | boxplot, 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 |
| 70 | will save images in a folder called "kableExtra" and return the address of |
| 71 | the file. |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 72 | } |