plotVisium: Plot Visium sample

View source: R/visium.graphics.R View source: R/.ipynb_checkpoints/visium.utilities-checkpoint.R

plotVisiumR Documentation

Plot Visium sample

Description

Main function to plot both histological and dimention reduction plots

Usage

plotVisium(
  v,
  z = NULL,
  cex = 1,
  type = "img",
  border = NA,
  z2col = num2col,
  plot.legend = TRUE,
  zlim = NULL,
  zfun = identity,
  spot.filter = NULL,
  pch = 16,
  num.leg.tic = NULL,
  label.clusters = FALSE,
  legend.args = list(),
  randomize.points = FALSE,
  order.points.by.z = FALSE,
  xaxt = "n",
  yaxt = "n",
  cluster.lab.adj = c(0.5, 0.5),
  cluster.lab.cex = 1,
  cluster.lab.font = 1,
  cluster.lab2col = NULL,
  show.cluster.sizes = FALSE,
  bg = NA,
  image.name = NULL,
  pie.fracs = NULL,
  he.img.width = 400,
  bty = "n",
  xaxs = "i",
  yaxs = "i",
  ...
)

Arguments

v

Seurat object or data.frame with two columns (x and y coordinates) or list of polygons (list with x and y items) in case of type='tiles')

z

z coordinate. Either numeric or categorical (factor/character)

cex

relative size of symbols

type

character, one of img, hex, rect, tiles, or xy, see Details.

border

colour of symbol borders

z2col

function to transform z to colous (if z is numeric) or one of viridis gradients (for example 'magma') or named vector of colours if z is character (names are levels of z)

plot.legend

logical

zlim

numerical vector with two items, used to trim z

zfun

function, transformation (log1p, sqrt, ect) of z (used only if z is numerical). Identity by default.

spot.filter

logical vector, specifies which spots should be plotted

pch

point type to be used with type='xy'

num.leg.tic

numerical, desired number of tics in gradient legend

label.clusters

label cluster on top of spots. Either logical, or character, if latter should provide names of each spot, it this case could be different from z

legend.args

list of arguments to be passed to legend function (for categorical z), only title is used for numerical z.

randomize.points

logical, should points be randomazed (makes sense if type is 'xy' and if spots overlap and ordered by z)

order.points.by.z

logical, make sense to show values with high z on the top if type is 'xy' (doublets for instance)

xaxt, yaxt

type of axis (see par), no axis are drown by default

cluster.lab.adj

adj parameterfor cluster labels (see text)

cluster.lab.cex

size of cluster labels

cluster.lab.font

font of cluster labels

cluster.lab2col

named vector that maps cluster names to colors to be used as text colors. All labels are black if NULL (default). Lables not mentioned in here will be shown in black as well.

show.cluster.sizes

logical, specifies whether number of cell per cluster should be shown in the legend

bg

color to be used as background on xy/tiles plots

image.name

name of image to plot, uses first if set to NULL. Use this parameter if v contains multiple visium objects.

pie.fracs

if specified plots pies instead of simple cycles. Matrix with number of rows equal to the number of spots, and number of columns equal to pie pieces.

he.img.width

integer, defines width (in pixels) the H&E figure should be resized to. Helps with speed of plotting and size of output files. Default is 400.

...

other arguments to be passed to graphical functions (see Details)

Details

Plots spots on top of H&E image, if type is 'img' (see plotVisiumImg for additional parameters), plots hexagonal representation if type is 'hex' (see plotVisiumHex). Type 'xy' forces dimention redutcion plot (by plot), coordinates either directly povided in v (as two-column data.frame) or extracted from umap slot of v, in the later case function attempts to use seurat_clusters if z is not specified. Type 'tiles' plots each spot as polygon, for example from Voronoi diagram (see deldir::deldir). Polygons should be supplied as first argument

Value

data.frame with user spot coordinates


iaaka/visutils documentation built on Jan. 17, 2025, 11:29 p.m.