Explore numeric and categorical columns with Boxplot
Installation
Development version from GitHub:
GitHub: https://github.com/zpio/ggexplorer
Show/Hide code
::install_github("zpio/ggexplorer") remotes
Show/Hide code
library(ggexplorer)
Examples
Dataset
Show/Hide code
iris
Show/Hide code
library(dplyr)
<- mtcars %>% mutate(dplyr::across(c(am, carb, cyl, gear, vs), as.factor))
mtcars mtcars
Basic Chart
Show/Hide code
# categorical target variable
plotBoxplot(iris, target = Species)
Show/Hide code
# numerical target variable
plotBoxplot(mtcars, target = mpg)
Fill
Show/Hide code
plotBoxplot(iris, target = Species, fill = "steelblue")
Opacity
Show/Hide code
plotBoxplot(iris, target = Species, alpha = 0.1)
Color of outliers
Show/Hide code
plotBoxplot(iris, target = Species, outlier_color = 'red', fill = "steelblue")
Customize outliers with: outlier_shape
, outlier_size
and outlier_alpha
Number of facet columns
Show/Hide code
plotBoxplot(iris, target = Species, ncol = 2)
Scales
Show/Hide code
plotBoxplot(iris, target = Species, scales = "free_x", fill = "steelblue")
Colour scales
Show/Hide code
plotBoxplot(iris, target = Species, ncol = 2) +
::scale_fill_viridis_d() +
ggplot2::scale_color_viridis_d() ggplot2
Flip
Show/Hide code
plotBoxplot(iris, target = Species, flip = TRUE, ncol = 2)