blob: fca9b4de8ae75380881c5132e974161b3d2c8668 [file] [log] [blame]
Hao Zhudefd1892020-09-09 00:08:09 -04001% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/mini_plots.R
3\name{spec_line}
4\alias{spec_line}
5\title{Helper functions to generate inline sparklines}
6\usage{
7spec_line(
8 x,
9 y = NULL,
10 width = 200,
11 height = 50,
12 res = 300,
13 same_lim = TRUE,
14 xlim = NULL,
15 ylim = NULL,
16 xaxt = "n",
17 yaxt = "n",
18 ann = FALSE,
19 col = "lightgray",
20 border = NULL,
21 frame.plot = FALSE,
22 lwd = 2,
Bill Evansa8ef1fb2020-09-12 22:55:46 -070023 pch = ".",
24 cex = 0.1,
25 type = "l",
26 polymin = NA,
Hao Zhudefd1892020-09-09 00:08:09 -040027 minmax = list(pch = ".", cex = lwd, col = "red"),
28 min = minmax,
29 max = minmax,
30 dir = if (is_latex()) rmd_files_dir() else tempdir(),
31 file = NULL,
32 file_type = if (is_latex()) "png" else "svg",
33 ...
34)
35}
36\arguments{
37\item{x, y}{Vector of values or List of vectors of values. y is optional.}
38
39\item{width}{The width of the plot in pixel}
40
41\item{height}{The height of the plot in pixel}
42
43\item{res}{The resolution of the plot. Default is 300.}
44
45\item{same_lim}{T/F. If x is a list of vectors, should all the plots be
46plotted in the same range? Default is True.}
47
48\item{xlim, ylim}{Manually specify plotting range in the form of
49\code{c(0, 10)}.}
50
51\item{xaxt}{On/Off for xaxis text}
52
53\item{yaxt}{On/Off for yaxis text}
54
55\item{ann}{On/Off for annotations (titles and axis titles)}
56
57\item{col}{Color for the fill of the histogram bar/boxplot box.}
58
59\item{border}{Color for the border.}
60
61\item{frame.plot}{On/Off for surrounding box (\code{spec_line} only). Default
62is False.}
63
64\item{lwd}{Line width for \code{spec_line}; within \code{spec_line}, the \code{minmax}
65argument defaults to use this value for \code{cex} for points. Default is 2.}
66
Bill Evansa8ef1fb2020-09-12 22:55:46 -070067\item{pch, cex}{Shape and size for points (if type is other than "l").}
68
69\item{type}{Passed to \code{plot}, often one of "l", "p", or "b", see
70\code{\link[graphics:plot.default]{graphics::plot.default()}} for more details. Ignored when 'polymin' is
71not 'NA'.}
72
73\item{polymin}{Special argument that converts a "line" to a polygon,
74where the flat portion is this value, and the other side of the polygon
75is the 'y' value ('x' if no 'y' provided). If 'NA' (the default), then
76this is ignored, otherwise if this is numeric then a polygon is
77created instead (and 'type' is ignored). Note that if 'polymin' is in
78the middle of the 'y' values, it will generate up/down polygons.}
79
Hao Zhudefd1892020-09-09 00:08:09 -040080\item{minmax, min, max}{Arguments passed to \code{points} to highlight minimum
81and maximum values in \code{spec_line}. If \code{min} or \code{max} are \code{NULL}, they
82default to the value of \code{minmax}. Set to an empty \code{list()} to disable.}
83
84\item{dir}{Directory of where the images will be saved.}
85
86\item{file}{File name. If not provided, a random name will be used}
87
88\item{file_type}{Graphic device. Support \code{png} or \code{svg}. SVG is recommended
89for HTML output.}
90
91\item{...}{extra parameters passing to \code{plot}}
92}
93\description{
94These functions helps you quickly generate sets of sparkline
95style plots using base R plotting system. Currently, we support histogram,
96boxplot, and line. You can use them together with \code{column_spec} to
97generate inline plot in tables. By default, this function will save images
98in a folder called "kableExtra" and return the address of the file.
99}