Create violin plot for multiple genes grouped by clusters
Source:R/visualization.R
plotClusterGeneViolin.Rd
Make violin plots for each given gene grouped by cluster variable and stack along y axis.
Arguments
- object
A liger object.
- gene
Character vector of gene names.
- groupBy
The name of an available categorical variable in
cellMeta
slot. This forms the main x-axis columns. UseFALSE
for no grouping. DefaultNULL
looks clustering result but will not group if no clustering is found.- colorBy
The name of another categorical variable in
cellMeta
slot. This split the main grouping columns and color the violins. DefaultNULL
will not split and color the violins.- box
Logical, whether to add boxplot. Default
FALSE
.- boxAlpha
Numeric, transparency of boxplot. Default
0.1
.- yFunc
Function to transform the y-axis. Default is
log1p(x*1e4)
. Set toNULL
for no transformation.- showLegend
Whether to show the legend. Default
FALSE
.- xlabAngle
Numeric, counter-clockwise rotation angle in degrees of X axis label text. Default
40
.- ...
Arguments passed on to
.ggplotLigerTheme
title,subtitle,xlab,ylab
Main title, subtitle or X/Y axis title text. By default, no main title or subtitle will be set, and X/Y axis title will be the names of variables used for plotting. Use
NULL
to hide elements.TRUE
forxlab
orylab
shows default values.legendFillTitle
Legend title text for fill aesthetics, often used for violin, box, bar plots. Default
NULL
shows the original variable name.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 bybaseSize + 2
.subtitleSize,xTextSize,yTextSize,legendTextSize
Size of subtitle text, axis texts and legend text. Default
NULL
controls bybaseSize
.yFacetSize
Size of facet strip label text on y-axis. Default
NULL
controls bybaseSize - 2
.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)
. DefaultNULL
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)
. DefaultNULL
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 toceiling(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
.
Details
If xlab
need to be set, set xlabAngle
at the same time. This is
due to that the argument parsing mechanism will partially match it to main
function arguments before matching the ...
arguments.
Examples
plotClusterGeneViolin(pbmcPlot, varFeatures(pbmcPlot)[1:10])
#> ℹ Subsetting dataset: "ctrl"
#> ℹ Subsetting dataset: "stim"
#> ✔ Subsetting dataset: "stim" ... done
#>
#> ℹ Subsetting dataset: "ctrl"
#> ✔ Subsetting dataset: "ctrl" ... done
#>