Displays the spatial course of spatial trajectory that was drawn with createSpatialTrajectories() on a surface plot. Increase the transparency via argument pt_alpha to highlight the trajectory's course.

plotSpatialTrajectories(
  object,
  ids = NULL,
  color_by = NULL,
  alpha_by = NULL,
  method_gs = NULL,
  smooth = NULL,
  smooth_span = NULL,
  width = NULL,
  pt_size = NULL,
  pt_alpha = 0.5,
  pt_alpha2 = 0.9,
  pt_clr = NULL,
  pt_clrp = NULL,
  clrp_adjust = NULL,
  pt_clrsp = NULL,
  sgmt_clr = NULL,
  sgmt_size = NULL,
  display_facets = FALSE,
  display_image = NULL,
  display_title = NULL,
  uniform_genes = NULL,
  arrow = ggplot2::arrow(length = ggplot2::unit(x = 0.125, "inches")),
  nrow = NULL,
  ncol = NULL,
  xrange = getCoordsRange(object)[["x"]],
  yrange = getCoordsRange(object)[["y"]],
  verbose = NULL,
  ...
)

Arguments

object

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

color_by

Character value. The variables by which to color the data points.

method_gs

Character value. The method according to which gene sets will be handled specified as a character of length one. This can be either 'mean or one of 'gsva', 'ssgsea', 'zscore', or 'plage'. The latter four will be given to gsva::GSVA().

smooth

Logical. If TRUE, a loess fit is used to smooth the values.

smooth_span

Numeric value. Controls the degree of smoothing. Given to argument span of stats::loess().

pt_size

Numeric value. Specifies the size of all points.

pt_alpha

Numeric value. Specifies the degree of transparency of all points.

pt_alpha2

Numeric value. Specifies the transparency of the spots that fall into the trajectory's reach.

pt_clr

Character value. Specifies the color of all points.

pt_clrp

The color palette to be used if the specified variable displayed by color is categorical/discrete. Run validColorPalettes() to see valid input.

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.

pt_clrsp

The color spectrum to be used if the specified variable displayed by color is continuous. Run validColorSpectra() to see valid input.

sgmt_size

The size of the segment arrrow specified as a numeric value.

display_facets

Logical value. If set to TRUE the plot is split via ggplot2::facet_wrap() such that each variable gets it's own subplot.

display_image

Logical. If set to TRUE the histology image of the specified sample is displayed underneath the plot.

display_title

Logical value. If set to TRUE an informative title is displayed.

uniform_genes

Character value. If set to 'discard' genes that are uniformly expressed across all barcode-spots of the specified coordinates data.frame are discarded. If set to 'keep' they are kept.

nrow, ncol

Numeric values or NULL. Used to arrange multiple plots.

xrange, yrange

Distance vector of length two or NULL. If not NULL, specifies the x- and y-range to which the spatial output is cropped. E.g. xrange = c(200, 500) results in the two dimensional space being cropped from x-coordinate 200px up to x-coordinate 500px. If NULL, the original range is used.

verbose

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

(Warning messages will always be printed.)

...

Used to absorb deprecated arguments or functions.

Value

Returns a ggplot that can be additionally customized according to the rules of the ggplot2 framework.

Examples

library(SPATA2)

data("example_data")

object <- example_data$object_UKF269T_diet

plotSpatialTrajectories(object, color_by = "histology", pt_clrp = "npg", ids = "horizontal_mid")