plotDim: Dimensionality Reduction Plot

Description Usage Arguments Value

View source: R/plot-dim.R

Description

Plots cells according to their coordinates in a dimensionality reduction (tSNE by default, but also PCA or diffusion map). Cells are colored according to a user set label that can range from gene expression, to metadata values, or cluster identity. See data.for.plot for more information about labels that can be chosen. Additionally, see plotDimDual to plot two continuous variables simultaneously, plotDimHighlight to highlight one group from a discrete label, plotDimArray to repeat the same plot across several sets of dimensions, and plotDim3D to plot in three dimensions.. Additionally, transitions.plot can plot the connections from the diffusion map onto the plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
plotDim(
  object,
  label,
  label.type = "search",
  reduction.use = c("tsne", "pca", "dm"),
  dim.x = 1,
  dim.y = 2,
  colors = NULL,
  discrete.colors = NULL,
  point.size = 1,
  alpha = 1,
  point.shapes = F,
  plot.title = label,
  legend = T,
  legend.title = "",
  legend.point.size = 3 * point.size,
  label.clusters = F,
  cells = NULL,
  x.lim = NULL,
  y.lim = NULL,
  color.lim = NULL,
  na.rm = F,
  transitions.plot = 0,
  transitions.alpha = 0.5,
  transitions.df = NULL
)

Arguments

object

An URD object

label

(Character) Data to use for coloring points (e.g. a metadata name, group ID from clustering, or a gene name)

label.type

(Character) Type of data to search for the label. Default is "search" which checks several data types in order. For more information: data.for.plot

reduction.use

(Character) Dimensionality reduction to use (tSNE, PCA, or Diffusion Map)

dim.x

(Numeric) Component to use on x-axis

dim.y

(Numeric) Component to use on y-axis

colors

(Character vector) Colors to use to generate a gradient scale to color continuous data

discrete.colors

(Character vector) Colors to use to color

point.size

(Numeric) Size of points on plot

alpha

(Numeric) Transparency of points on plot: 0 (Transparent) - 1 (Opaque)

point.shapes

(Logical) Should point shapes vary? This is useful in plots of discrete data types with many categories to help differentiate between similar colors.

plot.title

(Character) Title of the plot

legend

(Logical) Show a legend?

legend.title

(Character) Should the legend be titled?

legend.point.size

(Numeric) How big should points be in the legend?

label.clusters

(Logical) Label centroids of a discrete label?

cells

(Character vector) Cells to show on the plot (Default NULL is all cells.)

x.lim

(Numeric) Limits of x-axis (NULL autodetects)

y.lim

(Numeric) Limits of y-axis (NULL autodetects)

color.lim

(Numeric) Limits of the point color scale (NULL autodetects)

na.rm

(Logical) Should points with value NA for the desired data be removed from the plot?

transitions.plot

(Numeric or NULL) Number of transition matrix connections to add to the plot. NULL will plot all connections. (WARNING: Too many connections will produce an unreadable plot that takes a long time to plot. Start with 10,000.)

transitions.alpha

(Numeric) Maximum transparency of line segments representing transitions. (They are scaled based on their transition probability).

transitions.df

(data.frame) Output from edgesFromDM (potentially further curated) to display on the plot. If provided, transitions.plot is ignored and all transitions in the provided data.frame are plotted.

Value

A ggplot2 object


farrellja/URD documentation built on June 17, 2020, 4:48 a.m.