plot_embedding_sce: Plot selected PCs from an embedding saved in a...

Description Usage Arguments Value Examples

View source: R/plot_embedding.R

Description

Plot selected PCs from an embedding saved in a SingleCellExperiment object

Usage

1
2
3
4
5
6
7
8
9
plot_embedding_sce(
  sce,
  which_embedding,
  color_attr = NULL,
  color_title = color_attr,
  ellipse_attr = NULL,
  facet_attr = NULL,
  ...
)

Arguments

sce

SingleCellExperiment object; contains the embedding within the reducedDim slot

which_embedding

character; for the embedding to plot

color_attr

character; name of the attribute within colData to use for assigning colors (in lieu of color_vec in the plot_embedding function)

color_title

character; title to use for colors legend, defaults to the same as color_attr

ellipse_attr

character; name of the attribute within colData to use for drawing ellipse(s) (in lieu of ellipse_vec in the plot_embedding function)

facet_attr

character; name of the attribute within colData to use for faceting (in lieu of facet_vec in the plot_embedding function)

...

additional optional arguments - see plot_embedding function for details on other potential arguments: xpc, ypc, plot_title, color_title (if title is different from color_attr), ptsize, saveplot, plotfn, showplot, returngg, color_pal_vec, dimname

Value

default none; options to display plot (showplot), save plot (saveplot), and/or return ggplot2 object (returngg)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(DuoClustering2018)
library(SingleCellExperiment)
sce <- sce_full_Zhengmix4eq()[1:100,sample(1:3500,100,replace = FALSE)]
colData(sce)$Method <- matrix(sample(c('Method1','Method2'),100,replace = TRUE))
sce <- corralm(sce, splitby = 'Method')

# to plot and show only
plot_embedding_sce(sce = sce, 
                   which_embedding = 'corralm', 
                   xpc = 1, 
                   plot_title = 'corralm: PC1 by PC2',
                   color_attr = "Method", 
                   ellipse_attr = 'phenoid',
                   saveplot = FALSE)

# to return ggplot2 object and display, but not save
corralm_ggplot <- plot_embedding_sce(sce = sce, 
                                     which_embedding = 'corralm', 
                                     xpc = 1, 
                                     plot_title = 'corralm: PC1 by PC2',
                                     color_attr = 'Method', 
                                     ellipse_attr = 'phenoid', 
                                     returngg = TRUE, 
                                     saveplot = FALSE)

corral documentation built on Nov. 8, 2020, 8:25 p.m.