
Explore numeric and categorical columns with Violin
Installation
Development version from GitHub:
GitHub: https://github.com/zpio/ggexplorer
Show/Hide code
remotes::install_github("zpio/ggexplorer")Show/Hide code
library(ggexplorer)Examples
Dataset
Show/Hide code
irisShow/Hide code
library(dplyr)
mtcars <- mtcars %>% mutate(dplyr::across(c(am, carb, cyl, gear, vs), as.factor))
mtcarsBasic Chart
Show/Hide code
# categorical target variable
plotViolin(iris, target = Species)
Show/Hide code
# numerical target variable
plotViolin(mtcars, target = mpg)
Fill
Show/Hide code
plotViolin(iris, target = Species, fill = "steelblue")
Opacity
Show/Hide code
plotViolin(iris, target = Species, alpha = 0.1)
Number of facet columns
Show/Hide code
plotViolin(iris, target = Species, ncol = 2)
Scales
Show/Hide code
plotViolin(iris, target = Species, scales = "free_x", fill = "steelblue")
Boxplot
Show/Hide code
plotViolin(iris, target = Species, boxplot_show = TRUE, ncol = 2)
Adjust
Show/Hide code
plotViolin(iris, target = Species, adjust = 1, ncol = 2)
Trim
Show/Hide code
plotViolin(iris, target = Species, trim = TRUE, ncol = 2)
Colour scales
Show/Hide code
plotViolin(iris, target = Species, ncol = 2) +
ggplot2::scale_fill_viridis_d() +
ggplot2::scale_color_viridis_d()
Flip
Show/Hide code
plotViolin(iris, target = Species, flip = TRUE, ncol = 2)