Skip to contents

A serializable description of a boxplot. Build one with setup_BoxplotConfig() rather than calling this constructor directly.

Usage

BoxplotConfig(
  dat_path = NULL,
  title = NULL,
  origin = NULL,
  writer = NULL,
  legend_position = "top",
  legend_placement = "outside",
  x = NULL,
  group = NULL,
  observation = NULL,
  order = "input",
  transform = "none",
  geometry = "box",
  bandwidth = NULL,
  adjust = 1,
  density_points = 128L,
  paired = FALSE,
  pair_alpha = 0.35,
  pair_width = 1,
  comparisons = NULL,
  quartiles = "linear",
  whisker = 1.5,
  boxpoints = "none",
  point_size = 5,
  point_alpha = 0.6,
  point_spread = 0.5,
  horizontal = FALSE,
  na_rm = TRUE,
  labels = NULL,
  palette = NULL,
  fill_alpha = 0.25,
  xlab = NULL,
  ylab = NULL,
  margin_top = NULL,
  margin_right = NULL,
  margin_bottom = NULL,
  margin_left = NULL
)

Arguments

dat_path

Optional Character: Path to the data, read at draw time. The serializable alternative to passing data to draw().

title

Optional Character: Chart title.

origin

Optional Named character {"user", "default", "derived"}: Where each value came from, one entry per settable property. Absent on an authored config; written by the interface that resolved it.

writer

Optional Named character: Which interface wrote the config, as name and version. Absent on an authored config.

legend_position

Character {"top", "bottom", "left", "right", "top-left", "top-right", "bottom-left", "bottom-right"}: Legend anchor. Top/bottom anchors use horizontal rows; left/right anchors use a vertical column. Corner anchors align within the top or bottom row.

legend_placement

Character {"outside", "inside"}: Relation to the plotting area. Outside placement reserves space for the complete legend; inside placement overlays the data. Neither setting adds a missing legend.

x

Optional Character: Columns to summarize, one box each.

group

Optional Character: Column that splits each box by level.

observation

Optional Character: Column identifying observations for tooltips and pairing.

order

Character {"input", "mean", "median"}: Keep input order or sort categories by decreasing mean/median after transformation; empty boxes last.

transform

Character {"none", "scale", "minmax"}: Transform each input column before grouping. Scale subtracts the mean and divides by the sample standard deviation; minmax maps the available range to zero through one. Constant columns become zero and missing values remain missing.

geometry

Character {"box", "violin", "both"}: Distribution geometry.

bandwidth

Optional Numeric (0, Inf): Finite Gaussian kernel bandwidth.

adjust

Numeric (0, Inf): Finite bandwidth multiplier.

density_points

Integer [16, 4096]: Density evaluation grid size.

paired

Logical: Connect explicit IDs across adjacent categories.

pair_alpha

Numeric [0, 1]: Paired line opacity.

pair_width

Numeric (0, Inf): Finite paired line width in pixels.

comparisons

Optional Character: Name of a comparison data frame in the bound data list. Its columns follow draw_boxplot().

quartiles

Character {"linear", "hinges"}: Quartile convention.

whisker

Numeric [0, Inf): Finite IQR fence multiplier; zero uses full-range whiskers.

boxpoints

Character {"none", "all", "outliers"}: Values to overlay.

point_size

Numeric (0, Inf): Finite point diameter in pixels.

point_alpha

Numeric [0, 1]: Point opacity.

point_spread

Numeric [0, 1]: Fraction of box width occupied by offsets.

horizontal

Logical: Draw the boxes horizontally.

na_rm

Logical: Remove missing values. FALSE rejects missing input.

labels

Optional Character: Box labels. NULL uses the bound column names.

palette

Optional Character: Box colors, overriding the theme palette for this chart. NULL uses the package's box colors.

fill_alpha

Numeric [0, 1]: Box fill opacity.

xlab, ylab

Optional Character: Axis labels.

margin_top, margin_right, margin_bottom, margin_left

Optional Integer [0, Inf): Plot margins in pixels.

Value

BoxplotConfig object.

Details

x names one or more columns, one box each. group optionally names a column that splits every box into one per level. Statistics and point placement follow draw_boxplot(). Compiles to BoxplotSeriesOption and CustomSeriesOption in ECharts src/chart/boxplot/BoxplotSeries.ts and src/chart/custom/CustomSeries.ts.

Author

EDG

Examples

setup_BoxplotConfig(x = c("mpg", "hp"))@type
#> [1] "boxplot"