blob: 8d881d19fb296b29f4c1244bf66195250f4a6fc9 [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,
23 minmax = list(pch = ".", cex = lwd, col = "red"),
24 min = minmax,
25 max = minmax,
26 dir = if (is_latex()) rmd_files_dir() else tempdir(),
27 file = NULL,
28 file_type = if (is_latex()) "png" else "svg",
29 ...
30)
31}
32\arguments{
33\item{x, y}{Vector of values or List of vectors of values. y is optional.}
34
35\item{width}{The width of the plot in pixel}
36
37\item{height}{The height of the plot in pixel}
38
39\item{res}{The resolution of the plot. Default is 300.}
40
41\item{same_lim}{T/F. If x is a list of vectors, should all the plots be
42plotted in the same range? Default is True.}
43
44\item{xlim, ylim}{Manually specify plotting range in the form of
45\code{c(0, 10)}.}
46
47\item{xaxt}{On/Off for xaxis text}
48
49\item{yaxt}{On/Off for yaxis text}
50
51\item{ann}{On/Off for annotations (titles and axis titles)}
52
53\item{col}{Color for the fill of the histogram bar/boxplot box.}
54
55\item{border}{Color for the border.}
56
57\item{frame.plot}{On/Off for surrounding box (\code{spec_line} only). Default
58is False.}
59
60\item{lwd}{Line width for \code{spec_line}; within \code{spec_line}, the \code{minmax}
61argument defaults to use this value for \code{cex} for points. Default is 2.}
62
63\item{minmax, min, max}{Arguments passed to \code{points} to highlight minimum
64and maximum values in \code{spec_line}. If \code{min} or \code{max} are \code{NULL}, they
65default to the value of \code{minmax}. Set to an empty \code{list()} to disable.}
66
67\item{dir}{Directory of where the images will be saved.}
68
69\item{file}{File name. If not provided, a random name will be used}
70
71\item{file_type}{Graphic device. Support \code{png} or \code{svg}. SVG is recommended
72for HTML output.}
73
74\item{...}{extra parameters passing to \code{plot}}
75}
76\description{
77These functions helps you quickly generate sets of sparkline
78style plots using base R plotting system. Currently, we support histogram,
79boxplot, and line. You can use them together with \code{column_spec} to
80generate inline plot in tables. By default, this function will save images
81in a folder called "kableExtra" and return the address of the file.
82}