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,
  min_width = 200,
  scales = "fixed",
  label_position = "top"
)

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 min_width and container width.

min_width

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

label_position

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

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)