Skip to contents

Enables annotation mode where clicking a data point opens a label input. Annotations are stored as data and can be exported or accessed as a Shiny reactive input.

Usage

setAnnotation(myIO, labels = NULL, colors = NULL, mode = "click")

Arguments

myIO

an htmlwidget object created by the myIO() function

labels

character vector of preset label options (optional). If provided, shows a dropdown instead of free-text input.

colors

named character vector of category colors (optional). Names are category labels, values are CSS colors.

mode

"click" (default) to annotate individual points.

Value

A modified myIO htmlwidget object with annotation enabled.

Examples

myIO(data = mtcars) |>
  addIoLayer(
    type = "point", label = "pts",
    mapping = list(x_var = "wt", y_var = "mpg")
  ) |>
  setAnnotation(labels = c("outlier", "normal"))