Visualize gene expression or cell metadata with violin plot
plotGeneViolin(object, gene, byDataset = TRUE, groupBy = NULL, ...)plotTotalCountViolin(object, groupBy = "dataset", ...)
plotGeneDetectedViolin(object, groupBy = "dataset", ...)
ggplot if using a single gene and not splitting by dataset. Otherwise, list of ggplot.
A liger object.
Character gene names.
Logical, whether the violin plot should be splitted by
dataset. Default TRUE
.
Names of available categorical variable in cellMeta
slot. Use FALSE
for no grouping. Default NULL
looks clustering
result but will not group if no clustering found.
Arguments passed on to plotCellViolin
, .ggCellViolin
, .ggplotLigerTheme
slot
Choose the slot to find the y
variable. See Details.
Default "cellMeta"
.
yFunc
A function object that expects a vector/factor/data.frame
retrieved by y
as the only input, and returns an object of the same
size, so that the y-axis is replaced by this output. Useful when, for
example, users need to scale the gene expression shown on plot.
cellIdx
Character, logical or numeric index that can subscribe cells.
Missing or NULL
for all cells.
titles
Title text. A character scalar or a character vector with as
many elements as multiple plots are supposed to be generated. Default
NULL
.
violin,box,dot
Logical, whether to add violin plot, box plot or dot (scatter) plot, respectively. Layers are added in the order of dot, violin, and violin on the top surface. By default, only violin plot is generated.
violinAlpha,boxAlpha
Numeric, controls the transparency of layers.
Default 0.8
, 0.6
, respectively.
violinWidth,boxWidth
Numeric, controls the width of violin/box
bounding box. Default 0.9
and 0.4
.
dotColor,dotSize
Numeric, globally controls the appearance of all
dots. Default "black"
and getOption("ligerDotSize")
(1).
xlabAngle
Numeric, counter-clockwise rotation angle of X axis label
text. Default 45
.
raster
Logical, whether to rasterize the dot plot. Default NULL
automatically rasterizes the dot plot when number of total cells to be
plotted exceeds 100,000.
seed
Random seed for reproducibility. Default 1
.
legendFillTitle
Legend title text for fill aesthetics, often used for
violin, box, bar plots. Default NULL
shows the original variable name.
showLegend
Whether to show the legend. Default TRUE
.
legendPosition
Text indicating where to place the legend. Choose from
"top"
, "bottom"
, "left"
or "right"
. Default
"right"
.
baseSize
One-parameter control of all text sizes. Individual text element sizes can be controlled by other size arguments. "Title" sizes are 2 points larger than "text" sizes when being controlled by this.
titleSize,xTitleSize,yTitleSize,legendTitleSize
Size of main title,
axis titles and legend title. Default NULL
controls by
baseSize + 2
.
subtitleSize,xTextSize,yTextSize,legendTextSize
Size of subtitle text,
axis texts and legend text. Default NULL
controls by baseSize
.
panelBorder
Whether to show rectangle border of the panel instead of
using ggplot classic bottom and left axis lines. Default FALSE
.
colorLabels
Character vector for modifying category names in a
color legend. Passed to ggplot2::scale_color_manual(labels)
. Default
NULL
uses original levels of the factor.
colorValues
Character vector of colors for modifying category colors
in a color legend. Passed to ggplot2::scale_color_manual(values)
.
Default NULL
uses internal selected palette when <= 26 categories are
presented, otherwise ggplot hues.
legendNRow,legendNCol
Integer, when too many categories in one
variable, arranges number of rows or columns. Default NULL
,
automatically split to ceiling(levels(variable)/15)
columns.
plotly
Whether to use plotly to enable web based interactive browsing
for the plot. Requires installation of package "plotly". Default
FALSE
.
plotGeneViolin(pbmcPlot, varFeatures(pbmcPlot)[1],
groupBy = "leiden_cluster")
plotTotalCountViolin(pbmc)
plotGeneDetectedViolin(pbmc, dot = TRUE, box = TRUE, colorBy = "dataset")
Run the code above in your browser using DataLab