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.
plotProportionBox(
object,
useCluster = NULL,
conditionBy = NULL,
sampleBy = "dataset",
splitByCluster = FALSE,
dot = FALSE,
dotSize = getOption("ligerDotSize", 1),
dotJitter = FALSE,
...
)A ggplot object or a list of ggplot objects if
splitByCluster = TRUE.
A liger object.
Name of variable in cellMeta(object). Default
NULL uses default cluster.
Name of the variable in cellMeta(object) that
represents the condition. Must be a high level variable of the
sampleBy variable, i.e. each sample must belong to only one condition.
Default NULL does not group samples by condition.
Name of the variable in cellMeta(object) that
represents individual samples. Default "dataset".
Logical, whether to split the wide grouped box plot by
cluster, into a list of boxplots for each cluster. Default FALSE.
Logical, whether to add dot plot on top of the box plot. Default
FALSE.
Size of the dot. Default uses user option "ligerDotSize", or
1 if not set.
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,ylabMain 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 for xlab or ylab shows default values.
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.
colorPaletteFor continuous coloring, an index or a palette name to
select from available options from ggplot
scale_brewer or viridis.
Default "magma".
colorDirectionChoose 1 or -1. Applied when
colorPalette is from Viridis options. Default -1 use darker
color for higher value, while 1 reverses this direction.
colorLow,colorMid,colorHigh,colorMidPointAll four of these must be specified to customize palette with
naColorThe color code for NA values. Default "#DEDEDE".
scale_colour_gradient2. Default NULL.
plotlyWhether to use plotly to enable web based interactive browsing
for the plot. Requires installation of package "plotly". Default
FALSE.
# "boxes" are expected to appear as horizontal lines, because there's no
# "condition" variable that groups the datasets in the example object, and
# thus only one value exists for each "box".
plotProportionBox(pbmcPlot, conditionBy = "dataset")
Run the code above in your browser using DataLab