Draws split violin plot using ggplot2. Credit to jan-glx (https://stackoverflow.com/questions/35717353/split-violin-plot-with-ggplot2)

geom_split_violin(
  mapping = NULL,
  data = NULL,
  stat = "ydensity",
  position = "identity",
  ...,
  draw_quantiles = NULL,
  trim = TRUE,
  scale = "area",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping

ggplot mapping

data

data.frame

stat

ggplot identity

position

ggplot position

...

additional parameters to pass to layer()

draw_quantiles

draw quantiles. Default is NULL

trim

Trim data. Default is True.

scale

Default is area.

na.rm

Default is na.rm

show.legend

Default is NA

inherent.aes

Default is TRUE

Value

ggplot object

Examples


# split violin plot
ggplot(my_data, aes(x, y, fill = m)) + geom_split_violin()
#> Error in ggplot(my_data, aes(x, y, fill = m)): object 'my_data' not found