Skip to contents

Write the figure of the view shown (every view in a grid when the settings say so) as its Download button does, with the figure export's settings as they are (figure_export_set changes them: format, size, labels, legend, style): one SVG or PNG file, or several in one ZIP archive. Refused, saying why, when the figure cannot reproduce what the view shows (a render mode other than points, an overlay it cannot draw).

Usage

cellucid_figure_export(viewer)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

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: a list of files (The figures written: one file, or several in one ZIP archive), zip (The files were written in one ZIP archive (several formats or resolutions)).

Details

The viewer's action figure.export (Exports). It acts outside the viewer's state and history (a file the person receives in the browser, a publication, or what the browser keeps for later visits), which Undo does not take back: it makes no step of the history.

When an agent (Claude, ChatGPT) runs it, the viewer asks the person first (writes-file); from R it is not asked.

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_figure_export(viewer)
  print(request)
  # cellucid_action_result(request) waits for its outcome.
  cellucid_stop(viewer)
}