Skip to contents

Add StackTransform to a vega-lite spec.

Usage

vl_stack(
  spec,
  stack = NULL,
  as = NULL,
  groupby = NULL,
  offset = NULL,
  sort = NULL,
  .object = NULL
)

Arguments

spec

An input vega-lite spec

stack

The field which is stacked.

as

Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively. If a single string(e.g., "val") is provided, the end field will be "val_end".

groupby

The data fields to group by.

offset

Mode for stacking marks. One of "zero" (default), "center", or "normalize". The "zero" offset will stack starting at 0. The "center" offset will center the stacks. The "normalize" offset will compute percentage values for each stack point, with output values in the range [0,1].

Default value: "zero"

sort

Field that determines the order of leaves in the stacked charts.

.object

Directly input an object, rather than creating one via the other arguments. Should not be used in conjunction with the other arguments other than spec. Objects can be of type: StackTransform

Value

A modified Vega-Lite Spec