These functions helps you quickly generate sets of sparkline
style plots using base R plotting system. Currently, we support histogram,
boxplot, line, scatter and pointrange plots. You can use them together with
column_spec
to generate inline plot in tables. By default, this function
will save images in a folder called "kableExtra" and return the address of
the file.
spec_hist(
x,
width = 200,
height = 50,
res = 300,
breaks = "Sturges",
same_lim = TRUE,
lim = NULL,
xaxt = "n",
yaxt = "n",
ann = FALSE,
col = "lightgray",
border = NULL,
dir = if (is_latex()) rmd_files_dir() else tempdir(),
file = NULL,
file_type = if (is_latex()) "pdf" else svglite::svglite,
...
)
Vector of values or List of vectors of values.
The width of the plot in pixel
The height of the plot in pixel
The resolution of the plot. Default is 300.
The break
option in hist
. Default is "Sturges" but you can
also provide a vector to manually specify break points.
T/F. If x is a list of vectors, should all the plots be plotted in the same range? Default is True.
Manually specify plotting range in the form of
c(0, 10)
.
On/Off for xaxis text
On/Off for yaxis text
On/Off for annotations (titles and axis titles)
Color for the fill of the histogram bar/boxplot box.
Color for the border.
Directory of where the images will be saved.
File name. If not provided, a random name will be used
Graphic device. Can be character (e.g., "pdf"
)
or a graphics device function (grDevices::pdf
). This defaults
to "pdf"
if the rendering is in LaTeX and "svg"
otherwise.
for HTML output
extra parameters sending to hist()