Box plot of cluster proportion in each dataset, grouped by condition
Source:R/visualization.R
plotProportionBox.Rd
This function calculate the proportion of each category (e.g. cluster, cell type) within each dataset, and then make box plot grouped by condition. The proportion of all categories within one dataset sums up to 1. The condition variable must be a variable of dataset, i.e. each dataset must belong to only one condition.
Usage
plotProportionBox(
object,
useCluster = NULL,
conditionBy = NULL,
sampleBy = "dataset",
splitByCluster = FALSE,
dot = FALSE,
dotSize = getOption("ligerDotSize", 1),
dotJitter = FALSE,
...
)
Arguments
- object
A liger object.
- useCluster
Name of variable in
cellMeta(object)
. DefaultNULL
uses default cluster.- conditionBy
Name of the variable in
cellMeta(object)
that represents the condition. Must be a high level variable of thesampleBy
variable, i.e. each sample must belong to only one condition. DefaultNULL
does not group samples by condition.- sampleBy
Name of the variable in
cellMeta(object)
that represents individual samples. Default"dataset"
.- splitByCluster
Logical, whether to split the wide grouped box plot by cluster, into a list of boxplots for each cluster. Default
FALSE
.- dot
Logical, whether to add dot plot on top of the box plot. Default
FALSE
.- dotSize
Size of the dot. Default uses user option "ligerDotSize", or
1
if not set.- dotJitter
Logical, whether to jitter the dot to avoid overlapping within a box when many dots are presented. Default
FALSE
.- ...
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.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 bybaseSize + 2
.subtitleSize,xTextSize,yTextSize,legendTextSize
Size of subtitle text, axis texts and legend text. Default
NULL
controls bybaseSize
.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)/10)
columns.colorPalette
For continuous coloring, an index or a palette name to select from available options from ggplot
scale_brewer
orviridis
. Default"magma"
.colorDirection
Choose
1
or-1
. Applied whencolorPalette
is from Viridis options. Default-1
use darker color for higher value, while1
reverses this direction.colorLow,colorMid,colorHigh,colorMidPoint
All four of these must be specified to customize palette with
naColor
The color code for
NA
values. Default"#DEDEDE"
.scale_colour_gradient2
. DefaultNULL
.plotly
Whether to use plotly to enable web based interactive browsing for the plot. Requires installation of package "plotly". Default
FALSE
.