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
slotChoose the slot to find the y variable. See Details.
Default "cellMeta".
yFuncA 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.
cellIdxCharacter, logical or numeric index that can subscribe cells.
Missing or NULL for all cells.
titlesTitle text. A character scalar or a character vector with as
many elements as multiple plots are supposed to be generated. Default
NULL.
violin,box,dotLogical, 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,boxAlphaNumeric, controls the transparency of layers.
Default 0.8, 0.6, respectively.
violinWidth,boxWidthNumeric, controls the width of violin/box
bounding box. Default 0.9 and 0.4.
dotColor,dotSizeNumeric, globally controls the appearance of all
dots. Default "black" and getOption("ligerDotSize") (1).
xlabAngleNumeric, counter-clockwise rotation angle of X axis label
text. Default 45.
rasterLogical, whether to rasterize the dot plot. Default NULL
automatically rasterizes the dot plot when number of total cells to be
plotted exceeds 100,000.
seedRandom seed for reproducibility. Default 1.
legendFillTitleLegend title text for fill aesthetics, often used for
violin, box, bar plots. Default NULL shows the original variable name.
showLegendWhether to show the legend. Default TRUE.
legendPositionText indicating where to place the legend. Choose from
"top", "bottom", "left" or "right". Default
"right".
baseSizeOne-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,legendTitleSizeSize of main title,
axis titles and legend title. Default NULL controls by
baseSize + 2.
subtitleSize,xTextSize,yTextSize,legendTextSizeSize of subtitle text,
axis texts and legend text. Default NULL controls by baseSize.
panelBorderWhether to show rectangle border of the panel instead of
using ggplot classic bottom and left axis lines. Default FALSE.
colorLabelsCharacter vector for modifying category names in a
color legend. Passed to ggplot2::scale_color_manual(labels). Default
NULL uses original levels of the factor.
colorValuesCharacter 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,legendNColInteger, when too many categories in one
variable, arranges number of rows or columns. Default NULL,
automatically split to ceiling(levels(variable)/15) columns.
plotlyWhether 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