Plots changes in grouping proportion against the distance to a spatial annotation. Similar to plotSasBarplot, but plots density instead of discrete bars.

plotSasDensityplot(
  object,
  grouping,
  id = idSA(object),
  distance = distToEdge(object, id),
  resolution = getCCD(object) * 2,
  unit = getDefaultUnit(object),
  angle_span = c(0, 360),
  core = FALSE,
  clrp = NULL,
  clrp_adjust = NULL,
  position = "fill",
  expand_x = c(0.025, 0),
  expand_y = c(0.0125, 0),
  verbose = NULL,
  geom_density_bw = NULL,
  geom_density_adjust = 1/5,
  ...
)

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.

distance

Distance measure. Specifies the distance from the border of the spatial annotation to the horizon in the periphery up to which the screening is conducted. Defaults to a distance that covers the whole tissue section the spatial annotation is located on using distToEdge(). (This distance must not be exceeded.)

resolution

Distance measure. The resolution with which the expression gradient is inferred. Defaults are platform specific. See more in detail section of recSgsRes().

unit

Character value. The unit in which the distance to the spatial annotation is displayed on the x-axis.

If FALSE, plots the bin numbers instead.

angle_span

Numeric vector of length 2. Confines the area screened by an angle span relative to the center of its closest spatial annotation.

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.

expand_x, expand_y

Given to argument expand of ggplot2:scale_x/y_continuous().

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

geom_density_adjust

Numeric value. Adjusts the smoothing bandwidth of the density plot. For example, adjust = 1/2 means use half of the default bandwidth.

...

Needed arguments that depend on the input/unit combination. If one of both is 'px', argument object must be specified.

Value

A ggplot.

Distance measures

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