Learn R Programming

myIO (version 1.2.0)

setFacet: Set Faceting (Small Multiples)

Description

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"
)

Value

Modified myIO widget.

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".

Examples

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

Run the code above in your browser using DataLab