Add violin plot
Usage
add_violin(
plot,
dodge_width = NULL,
alpha = 0.3,
saturation = 1,
draw_quantiles = NULL,
trim = FALSE,
linewidth = 0.25,
scale = "width",
...
)
Arguments
- plot
A
tidyplot
generated with the functiontidyplot()
.- dodge_width
For adjusting the distance between grouped objects. Defaults to
0.8
.- alpha
A
number
between0
and1
for the opacity of an object. A value of0
is completely transparent,1
is completely opaque.- saturation
A
number
between0
and1
for the color saturation of an object. A value of0
is completely desaturated (white),1
is the original color.- draw_quantiles
If
not(NULL)
(default), draw horizontal lines at the given quantiles of the density estimate.- trim
If
TRUE
(default), trim the tails of the violins to the range of the data. IfFALSE
, don't trim the tails.- linewidth
Thickness of the line in points (pt). Typical values range between
0.25
and1
.- scale
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.
- ...
Arguments passed on to the
geom
function.
Examples
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_violin()
# Changing arguments:
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_violin(saturation = 0.6)
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_violin(draw_quantiles = c(0.25, 0.5, 0.75))
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_violin(trim = TRUE)
study %>%
tidyplot(x = treatment, y = score, color = treatment) %>%
add_violin(linewidth = 1)