Skip to contents

A serializable description of a line chart. Build one with setup_LineConfig() rather than calling this constructor directly.

Usage

LineConfig(
  dat_path = NULL,
  title = NULL,
  origin = NULL,
  writer = NULL,
  legend_position = "top",
  legend_placement = "outside",
  x = NULL,
  y = NULL,
  group = NULL,
  blocks = NULL,
  smooth = FALSE,
  area = FALSE,
  points = TRUE,
  zoom = FALSE,
  palette = NULL,
  block_color = NULL,
  block_opacity = 0.2,
  square = FALSE,
  equal_axes = FALSE,
  pad = 0.04,
  xlim = NULL,
  ylim = NULL,
  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. 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.

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: Column along the horizontal axis. A numeric column gets a value axis, a Date or POSIXct column a time axis with adaptively chosen labels, and any other column a category axis.

y

Optional Character: Columns to plot, one line each.

group

Optional Character: Column to group and color lines by. Splits a single y column into one line per level; cannot be combined with several y columns or with blocks.

blocks

Optional Character: Column whose contiguous runs shade vertical background bands.

smooth

Logical: Draw smoothed lines.

area

Logical: Fill the area under each line.

points

Logical: Show a marker at each data value.

zoom

Logical: Enable the zoom control.

palette

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

block_color

Optional Character: Band colors.

block_opacity

Numeric [0, 1]: Band opacity.

square

Logical: If TRUE, draw the plotting box square – equal height and width in pixels, excluding axis labels and margins.

equal_axes

Logical: If TRUE, give one data unit the same size in pixels on both axes. Set with square for a plot that is both, such as an ROC curve; the two axes are then made to span the same interval. Requires a numeric x.

pad

Numeric [0, Inf): Fraction of the data range to extend each axis by when the limits are not given.

xlim, ylim

Optional Numeric: Axis limits, length 2. NULL derives them from the data, padded by pad. On a time axis xlim is in epoch milliseconds, the unit the chart positions by.

xlab, ylab

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

margin_top, margin_right, margin_bottom, margin_left

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

Value

LineConfig object.

Details

x names the column along the horizontal axis. y names one or more columns, one line each, as BarConfig does.

Author

EDG

Examples

setup_LineConfig(x = "wt", y = "mpg")@type
#> [1] "line"