Skip to contents

Splits the chart into a grid of panels, one per unique value of the faceting variable. Each panel shows the same layers filtered to that subset of the data.

Usage

setFacet(
  myIO,
  var,
  ncol = NULL,
  minWidth = NULL,
  scales = "fixed",
  labelPosition = NULL,
  ...
)

Arguments

myIO

A myIO widget object.

var

Character. Column name to facet by. Must exist in at least one layer's data.

ncol

Integer or NULL. Number of columns in the grid. If NULL, auto-computes from minWidth and container width.

minWidth

Numeric. Minimum panel width in pixels when ncol is NULL. Default 200.

scales

Character. Scale sharing mode:

  • "fixed" – all panels share x and y scales (default)

  • "free_x" – independent x scales per panel

  • "free_y" – independent y scales per panel

  • "free" – independent x and y scales per panel

labelPosition

Character. Where to show panel labels: "top" (default) or "bottom".

...

reserved; accepts the deprecated min_width and label_position aliases for minWidth and labelPosition.

Value

Modified myIO widget.

Examples

myIO(iris) |>
  addIoLayer("point", label = "pts",
             mapping = list(x_var = "Sepal.Length", y_var = "Sepal.Width")) |>
  setFacet("Species", ncol = 3)