Creates box plots with Insper's visual identity, with optional jittered points and notches.
Usage
insper_boxplot(
data,
x,
y,
fill = NULL,
palette = "main",
add_jitter = NULL,
add_notch = FALSE,
box_alpha = 0.8,
...
)Arguments
- data
A data frame.
- x
<
data-masked> Categorical variable for the x-axis.- y
<
data-masked> Numeric variable for the y-axis.- fill
Fill aesthetic. Accepts one of the options below.
A bare column name, mapped to fill (e.g.,
fill = Species).A quoted color string, used as a static fill (e.g.,
fill = "lightblue").NULL(default), which uses Insper turquesa.
- palette
Character. Palette for mapped variables. Default is
"main".- add_jitter
Logical or
NULL. IfTRUE, adds jittered points. IfNULL(default), adds them only when every group has fewer than 100 observations.- add_notch
Logical. If
TRUE, draws notched boxes. Default isFALSE.- box_alpha
Numeric. Box opacity, from 0 to 1. Default is 0.8.
- ...
Additional arguments passed to
ggplot2::geom_boxplot().
Examples
if (FALSE) { # has_insper_fonts()
# Simple boxplot with default fill
insper_boxplot(iris, x = Species, y = Sepal.Length)
# Static fill color
insper_boxplot(iris, x = Species, y = Sepal.Length, fill = "#F89D49")
# Variable fill mapping
insper_boxplot(iris, x = Species, y = Sepal.Length, fill = Species)
# Boxplot without jitter
insper_boxplot(iris, x = Species, y = Sepal.Length, add_jitter = FALSE)
}
