Individual Violin Plots per Country
sahel_ggviolin.Rd
Individual Violin Plots per Country
Usage
sahel_ggviolin(
data,
variable,
countries,
alpha_boxplot = 0.5,
alpha_violin = 0.8,
width_boxplot = 0.5,
width_violin = 0.8,
title = deparse(substitute(variable)),
subtitle = "Violin Plot",
caption = NULL,
xtitle = NULL,
ytitle = NULL,
scale = NULL,
add_boxplot = TRUE,
theme = themeaspdark
)
Arguments
- data
A data frame
- variable
Variable name to plot. Continuous or count.
- countries
Variable name to plot. Continuous or count.
- alpha_boxplot
Transparency for the boxplot element.
- alpha_violin
Transparency for the violin element.
- width_boxplot
Width for the boxplot element.
- width_violin
Width for the violin element.
- title
Plot title
- subtitle
Plot subtitle
- caption
Plot caption
- xtitle
Plot x-axis title
- ytitle
Plot y-axis title
- scale
Scaling function from
{ggplot2}
- add_boxplot
TRUE
by default. Add a boxplot inside the violin plots?- theme
Theme applied
Examples
library(patchwork)
sahel_ggviolin(
data = sahel_sim,
variable = hh_income,
countries = country_names,
title = "Household Income",
scale = ggplot2::scale_x_log10
) + sahel_ggviolin(
data = sahel_sim,
variable = hh_consumption,
countries = country_names,
title = "Household Consumption",
scale = ggplot2::scale_x_log10
)