Skip to contents

Give one category of a categorical column another colour.

Usage

cellucid_color_category(viewer, field, category, color)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

field

A categorical column of the cells by name (source "obs"). A named list. Required.

source

Categories belong to columns of the cells. Exactly "obs". Required.

category

A category label as the legend shows it. Text (at least 1 character). Required.

color

A colour as six hex digits, "#e41a1c". Text. Required.

Value

A cellucid_action_request, at once and invisibly: the action is sent now, or when the viewer's channel opens. cellucid_action_result(request) returns its outcome (what it did, as names, counts and ids), or NULL when it had nothing to report; request$step is the history step it made.

Details

The viewer's action color.category (Colours). It changes what the viewer shows: one step of the viewer's history, labelled as R's, undone like any other. The state it can change: colors.

See also

cellucid_act() sends any action by its type, and cellucid_action_result() collects its answer.

Examples

if (interactive() && requireNamespace("SeuratObject", quietly = TRUE)) {
  data("pbmc_small", package = "SeuratObject")
  viewer <- cellucid_view(SeuratObject::UpdateSeuratObject(pbmc_small))
  request <- cellucid_color_category(viewer, category = "T cells",
      color = "#e41a1c", field = list(key = "cell_type",
          source = "obs"))
  print(request)
  # cellucid_action_result(request) waits for its outcome.
  cellucid_stop(viewer)
}