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,
  group_subset = NULL,
  plot_type = "surface",
  line_alpha = 1,
  line_color = "black",
  line_size = 1,
  line_type = "solid",
  alpha = 0,
  fill = NA,
  incl_edge = FALSE,
  merdge_edge = FALSE,
  incr_vert = FALSE,
  bcsp_rm = character(0),
  outlier_rm = TRUE,
  eps = recDbscanEps(object),
  minPts = recDbscanMinPts(object),
  concavity = NULL,
  expand_outline = 0,
  ...
)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

grouping

Character value. The grouping variable of interest. Use getGroupingOptions() to obtain all valid input options.

group_subset

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

plot_type

Character value. Either 'surface' or the name of a conducted dimensional reduction.

line_alpha

Numeric. Affects alpha of main lines of the plot.

line_color

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

line_size

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

line_type

Character. The line type. One of 'blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash' and 'twodash'.

incl_edge

Logical. If TRUE, include tissue section outline. See examples of getTissueOutlineDf().

incr_vert

Logical value. If TRUE, the number of vertices of the polygon to be plotted is increased by linear interpolation. This can lead to smoother visualization but also to increased runtime.

bcsp_rm

Character vector or NULL. If character, specifies barcode-spots that are removed before analysis or plotting. (Deprecated in favor of bcs_rm).

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

eps

Distance measure. Given to eps of dbscan::dbscan(). Determines the size (radius) of the epsilon neighborhood.

concavity

Numeric value. Given to argument concavity of concaveman::concaveman(). Determines the relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull. You can use values lower than 1, but they can produce pretty crazy shapes.

expand_outline

Distance measure with which to expand the outline. Must be provided in pixel units!

...

Additional arguments given to ggforce::geom_polygon(). 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


library(SPATA2)
library(tidyverse)

data("example_data")

object <- loadExampleObject("UKF275T", meta = TRUE)

plotSurface(object, color_by = "bayes_space") +
 ggpLayerGroupOutline(object, grouping = "bayes_space", group_subset = c("B1", "B2"))