statViolinPlotSingle | R Documentation |
creates a ggplot object showing a violin plot
statViolinPlotSingle(
data,
column = 1,
removeNA = TRUE,
sampleSize = NA,
outlineColor = "black",
fillColor = "red",
outlineSize = 0.5,
outlineType = "solid",
violinAlpha = 1,
scale = c("area", "count", "width")[1],
trim = TRUE,
bandwidth = 1,
quantiles = NULL,
xAxis = FALSE,
yAxis = TRUE,
yLabel = ifelse(!is.Class(data, "data.frame"), NA, ifelse(is.character(column),
paste(column, collapse = ""), paste(colnames(data)[column], collapse = ", "))),
title = NA,
vertical = FALSE,
xDefault = FALSE,
xLimits = c(-0.75, 0.75),
yDefault = TRUE,
yLimits = c(0, NA),
...
)
data |
the data to be plotted, can be a numeric/character/etc vector or data.frame like (or tibble etc). If it is data.frame or similar the column argument defines which column is to be used |
column |
defines which column is to be used for the boxplot. Can be integer or character (column name), note that if both (character) column and yLabel are defined, column is used as label for the Y-axis |
removeNA |
if TRUE, the NA 'values' in the vector will be removed prior to plotting. @note this will remove warning messages and errors |
sampleSize |
allows to the use of a sample of the data to be used for the boxplot. By default sampleSize = NA, in which case all data is used |
outlineColor |
defines the color of the line around the 'violin' |
fillColor |
defines the color of the 'violin' itself |
outlineSize |
defines the width of the line around the 'violin' |
outlineType |
defines the linetype of the line around the 'violin' |
violinAlpha |
defines the alpha ('see through' value) the 'violin' |
scale |
default = "area", other valid values are "count" and "width". if "area" (default), all violins have the same area (before trimming the tails). If "count", areas are scaled proportionally to the number of observations. If "width", all violins have the same maximum width. @note taken from ?geom_violin, there is no sense in setting this argument for a single violin plot |
trim |
If TRUE (default), trim the tails of the violins to the range of the data. If FALSE, don't trim the tails. @note taken from ?geom_violin |
bandwidth |
defines the 'adjust' parameter, which is the adjustment of smoothing bandwidth. 1/2 means half of default bandwidth –> makes the outline more 'jagged' |
quantiles |
draws lines at the specified quantiles, eg c(0.25,0.5,0.25). If NULL, nothing is drawn |
xAxis |
defines if the x-axis is shown |
yAxis |
defines if the x-axis is shown |
yLabel |
set y-axis title |
title |
sets title of graph |
vertical |
if TRUE, flips x- and y-axis |
xDefault |
default is set to FALSE, together with xLimits this can be used to tweak the positioning and with of the box |
xLimits |
default = c(-0.75,0.75), together with xDefault this can be used to tweak the positioning and with of the box |
yDefault |
default is set to TRUE, together with yLimits, this can be used to define the exact range of the Y-axis |
yLimits |
default = c(0,NA), together with yLimits, this can be used to define the exact range of the Y-axis |
... |
can be used to pass on other arguments to graphAdjust() (like xLimits, xExpand, etc) |
a ggplot object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.