Plot function for Seurat/Kandinsky data, as an alternative to Seurat SpatialDim/SpatialFeature plots

KanPlot(
  seurat = NULL,
  feature = NULL,
  fovs = NULL,
  assay = DefaultAssay(seurat),
  layer = "data",
  palette_cont = "inferno",
  palette_discrete = c24,
  alpha = NULL,
  show_border = F,
  border.size = NULL,
  border.col = "black",
  max.cap = 0.99,
  bg_img = F,
  bg_type = c("img", "mask"),
  max.px = 5e+05,
  theme = c("dark", "light"),
  pt.shape = c(16, 21),
  pt.stroke = 0.1,
  pt.size = 0.1,
  lg.pt.size = 2
)

Arguments

seurat

a Seurat object containing Kandinsky data (`KanData()`)

feature

character string specifying the discrete or continuous variable to plot

fovs

vector of fov identifiers selected for plotting. If NULL (default), all fovs will be considered for plotting

assay

the name of Seurat assay to use to search for the feature to plot

layer

the name of Seurat layer to use to search for the feature to plot

palette_cont

character string or vector specifying the color palette to use for continuous variables. It can be a vector of color names, or the name of a `viridis` palette

palette_discrete

character string or vector specifying the color palette to use for discrete variables.

alpha

numeric value between 0 and 1 specifying the level of transparency to apply to polygon/spots/bins. 0 means completely transparent, 1 mean means completely opaque. If not specified, default value is set to 1.

show_border

boolean, whether plotting (TRUE) or not (FALSE) polygon borders.

border.size

numeric, polygon border thickness passed to `lwd` parameter of geom_sf() function when `show_border` is set to TRUE. If not specified, default value is set to 0.01

border.col

color of polygon borders when `show_border` is set to TRUE.

max.cap

numeric value between 0 and 1 specifying the higher percentile cutoff value for continuous variables. Default value is set to 0.99

bg_img

boolean, whether plotting (TRUE) or not (FALSE) any image associated with Kandinsky data, like Visium H&E image,in the plot background.

bg_type

image type to be plotted in the background when `bg_img = TRUE`. Must be one of the following: `img`, `mask`.

max.px

numeric value indicating the number of pixels to plot from the background image, when `bg_img = TRUE`. higher values will give a better resolution and a heavier image size

theme

color style of the plot background and text. Must one of the following: `dark`, `light`.

pt.shape

numeric, shape to apply to point geometries. Must be one of the following: 16 (no border), 21 (with border, default)

pt.stroke

numeric, size of point borders. Only applied when pt.shape is set to 21 (default). Default is 0.1

pt.size

numeric, point size to apply to centroids (when no polygons are available)

lg.pt.size

numeric, size of points reported in plot legend (when no polygons are available)

Value

plot object generated with ggplot