ggviolin: Plot a violin plot

Description Usage Arguments Value Examples

View source: R/ggviolin.R

Description

Plot a violin plot

Usage

1
2
3
4
5
6
7
8
9
ggviolin(
  data,
  variable,
  x = NULL,
  mapping = NULL,
  is_jitter = FALSE,
  jitter_pars = list(),
  ...
)

Arguments

data

A data frame

variable

Name of the variable to plot

x

Optional name of a categorial variable for the horizontal axis

mapping

A named list of arguments to ggplot2::aes_string, containing additional mappings

is_jitter

Whether to add jittered points

jitter_pars

Parameters to be passed to ggplot2::geom_jitter

...

Parameters to be passed to ggplot2::geom_violin

Value

A ggplot

A ggplot

Examples

1
2
3
mtcars$vs <- factor(mtcars$vs)
ggviolin(mtcars, "mpg", is_jitter = TRUE, jitter_pars = list(width = 0.2))
ggviolin(mtcars, "mpg", mapping = list(fill = "vs"), alpha = 0.5)

rscherrer/ggsim documentation built on June 11, 2020, 2:22 p.m.