Adds segments and, if desired, labels to the surface plot that point towards and highlight the position of spatial annotations.

ggpLayerSpatAnnPointer(
  object,
  ids = NULL,
  tags = NULL,
  test = "any",
  color_by = NULL,
  ptr_angles = 45,
  ptr_labels = NULL,
  ptr_lengths = "250um",
  ptr_alpha = 0.9,
  ptr_arrow = NULL,
  ptr_color = "black",
  ptr_size = 1,
  text_alpha = 0.9,
  text_color = "black",
  text_dist = 0,
  text_nudge_x = 0,
  text_nudge_y = 0,
  text_size = 4,
  point_at = "center",
  seed = NULL,
  clrp = NULL,
  clrp_adjust = NULL
)

Arguments

object

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

tags

Character vector or NULL. If character, the tags for the image annotation selection. See section Selection of spatial annotations for more information.

test

Character value. One of c('any'. 'all', 'identical', 'not_identical', 'none'). Specifies how input for tags is used to select spatial annotations. See section Selection of spatial annotations for more information.

color_by

Character value or NULL. If character, one of 'id' or 'label' which colors the the pointers accordingly.

ptr_angles, ptr_lengths

Numeric value of length 1 or of length equal to the number of spatial annotations. Specifies the angle from which the segments points towards the spatial annotation as well as their length. ptr_lengths works within the SPATA2 distance framework. See section Distance measures for more information.

ptr_labels

Specifies if and how the pointers are labeled. If NULL, the default, the spatial annotations are labeled by their ID. If character, specifies the exact label of each spatial annotation and should be of length 1 or of length equal to the number of spatial annotations. If FALSE, no text is displayed.

ptr_alpha

Numeric value. Specifies the transparency of the pointers.

ptr_arrow

NULL or arrow as displayed by grid::arrow().

ptr_color

Character value. Specifies the color of the pointers if color_by is not a character.

ptr_size

Numeric value. Specifies the size (thickness) of the pointers.

text_dist

Distance measure. Specifies the distance from the text to the pointer.

point_at

Character value. If 'center', the pointer is directed at the center of the spatial annotation. If 'border', the pointer points at a random point of the spatial annotation border - recommended if the spatial annotation is big.

seed

Numeric value or NULL. If numeric, sets seed before picking a random point of the spatial annotation border if point_at = 'border'.

clrp

Character value. Specifies the color palette to be used to represent groups of discrete variables. Run validColorPalettes() to obtain valid input options.

clrp_adjust

Named character vector or NULL. If character, it adjusts the color palette that is used to represent the groups. Names of the input vector must refer to the group and the respective named element denotes the color with which to represent the group.

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.

Distance measures

The vignette on distance measures in SPATA2 has been replaced. Click here to read it.