Highlights groups of barcode-spots by encircling them. Depending on the plot_type this can be added to a surface plot or a dimensional reduction plot.

ggpLayerGroupOutline(
  object,
  grouping,
  groups_subset = NULL,
  plot_type = "surface",
  line_color = "black",
  line_size = 1,
  alpha = 0,
  bcsp_rm = character(0),
  outlier_rm = TRUE,
  eps = (getCCD(object, "px") * 1.25),
  minPts = 3,
  concavity = NULL,
  expand_outline = getCCD(object, "px") * 1.1,
  ...
)

Arguments

object

An object of class spata2.

groups_subset

Character value or NULL. If character, specifies the exact groups that are encircled. If NULL, all groups are encircled.

plot_type

Character value. Either 'surface', 'tsne' or 'umap'.

line_color

Character. Affects color of the main lines of the plot.

line_size

Numeric. Affects size of the main lines of the plot.

bcsp_rm

Character vector or NULL. If character, specifies barcode-spots that are removed before analysis or plotting.

outlier_rm, minPts

Logical. If TRUE, spatial outlier of the group to outline are removed from the outline via dbscan::dbscan(..., minPts = minPts). Ignored if plot_type is not 'surface'.

concavity

Given to concavity of ggforce::geom_mark_hull(). Can be optimized for every sample via object <- setDefault(object, concavity = ...). Default by object initiation is 1.

expand_outline

Distance measure by which the outline of the area is expanded.

...

Additional arguments given to ggforce::geom_mark_hull(). Affects the encircling.

Value

ggpLayer*()-functions return lists of ggproto objects that can be added to ggplots via the + operator. In most of the cases they are supposed to be added to plots created with the plotSurface*()

family.

Examples


 object <- downloadPubExample("269_T")

 plotImageGgplot(object) +
  ggpLayerGroupOutline(
    object = object,
    plot_type = "surface",
    grouping = "histology",
    groups_subset = "tumor",
    line_color = color_vector("npg")[1]
    )