Skip to contents

Quick boxplot from raw data with optional grouping for multiple traces. Boxplot statistics (min, Q1, median, Q3, max) are computed automatically using grDevices::boxplot.stats().

Usage

draw_boxplot(
  data,
  labels = NULL,
  group = NULL,
  horizontal = FALSE,
  color = NULL,
  fill_alpha = 0.25,
  na.rm = TRUE,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  theme = NULL,
  margins = NULL,
  width = NULL,
  height = NULL,
  verbosity = 1L,
  filename = NULL
)

Arguments

data

Numeric or list: A list of numeric vectors (one per box), or a single numeric vector when group is provided. For ungrouped named lists, names(data) are used as labels when labels is not supplied.

labels

Optional Character: Category labels for each box. Ignored when group is provided (group levels are used instead). When omitted for ungrouped named lists, names(data) are used.

group

Optional Vector: Grouping variable. When provided, data must be a numeric vector, and boxplot statistics are computed per group. Each group gets its own colored series.

horizontal

Logical: Whether to draw horizontal boxplots.

color

Optional Character: Box color or colors. For ungrouped boxplots, a single color used at full opacity for borders and at fill_alpha opacity for the fill. For grouped boxplots, defaults to rtemis_colors; recycled as needed.

fill_alpha

Numeric [0, 1]: Opacity for the box fill color.

na.rm

Logical: Whether to remove NA values before computing boxplot statistics.

xlab

Optional Character: X-axis title (bottom axis). Overrides the value-axis name inferred from a single-element named list passed as data.

ylab

Optional Character: Y-axis title (left axis). Overrides the value-axis name inferred from a single-element named list passed as data.

title

Optional Character: Chart title.

theme

Optional Theme: Theme override.

margins

Optional Named numeric vector or named list: Plot margins in pixels (or percentage strings) for any of "top", "right", "bottom", "left". Unspecified sides keep echarts' default auto-sizing. See draw_line() for details.

width

Optional Character or Numeric: Widget width.

height

Optional Character or Numeric: Widget height.

verbosity

Integer [0, Inf): Verbosity level for removed-NA messages.

filename

Optional Character: If provided, save the widget to this file via save_drawing().

Value

htmlwidget: Widget object.