Skip to contents

The seam between convenient input and a complete, validated object. Every argument is optional, which is what lets the published schema require nothing.

Usage

setup_DensityConfig(
  x = NULL,
  group = NULL,
  n = 512L,
  bw = "nrd0",
  na_rm = TRUE,
  palette = NULL,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  margin_top = NULL,
  margin_right = NULL,
  margin_bottom = NULL,
  margin_left = NULL,
  dat_path = NULL,
  origin = NULL,
  writer = NULL,
  legend_position = "top",
  legend_placement = "outside",
  bandwidth = NULL,
  kernel = "gaussian",
  adjust = 1,
  fill_alpha = 0.25,
  mode = "overlap",
  order = "input"
)

Arguments

x

Optional Character: Columns to estimate, one distribution per column.

group

Optional Character: Column to split the estimate by.

n

Integer [2, Inf): Points at which the density is estimated.

bw

Character or Numeric: Bandwidth selector ("nrd0", "nrd", "ucv", "bcv", "SJ", "SJ-ste", "SJ-dpi"). Numeric input is normalized to bandwidth by the setup function.

na_rm

Logical: If TRUE, drop NA values before estimating.

palette

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

xlab, ylab

Optional Character: Axis labels. NULL derives them from the data.

title

Optional Character: Chart title. Declared here because it is the one property every chart type has; palette is not (four take a colormap instead), and axis labels and margins are cartesian-only.

margin_top, margin_right, margin_bottom, margin_left

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

dat_path

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

origin

Optional Named character: Where each value came from. Normally computed from which arguments were supplied; pass it only when restoring a config that already carries provenance.

writer

Optional Named character: Which interface wrote the 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.

bandwidth

Optional Numeric (0, Inf): Explicit finite smoothing bandwidth in measurement units, overriding the selector.

kernel

Character: One of "gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", or "optcosine".

adjust

Numeric (0, Inf): Finite bandwidth multiplier.

fill_alpha

Numeric [0, 1]: Distribution fill opacity.

mode

Character {"overlap", "ridge"}: Overlay samples or align rows on common x and y scales. Ridge rows use sample names in place of a legend. Increase figure height for many rows.

order

Character {"input", "mean", "median"}: Sample order. Summary orders are decreasing, retain ties in input order, and place empty samples last.

Value

DensityConfig object.

Author

EDG

Examples

draw(setup_DensityConfig(x = "mpg"), data = mtcars)