Skip to contents

This function produces combined plot on group level (e.g. dataset, other metadata variable like biological conditions). Scatter plot of dimension reduction with cluster labeled is generated per group. Furthermore, a stacked barplot of cluster proportion within each group is also combined with the subplot of each group.

Usage

plotGroupClusterDimRed(
  object,
  useGroup = "dataset",
  useCluster = NULL,
  useDimRed = NULL,
  combinePlot = TRUE,
  droplevels = TRUE,
  relHeightMainLegend = c(5, 1),
  relHeightDRBar = c(10, 1),
  mainNRow = NULL,
  mainNCol = NULL,
  legendNRow = 1,
  ...
)

Arguments

object

A liger object with dimension reduction, grouping variable and cluster assignment in cellMeta(object).

useGroup

Variable name of the group division in metadata. Default "dataset".

useCluster

Name of variable in cellMeta(object). Default NULL uses default cluster.

useDimRed

Name of the variable storing dimensionality reduction result in cellMeta(object). Default NULL use default dimRed.

combinePlot

Whether to return combined plot. Default TRUE. If FALSE, will return a list containing only the scatter plots.

droplevels

Logical, whether to perform droplevels() on the selected grouping variable. Default TRUE will not show groups that are listed as categories but do not indeed have any cells.

relHeightMainLegend

Relative heights of the main combination panel and the legend at the bottom. Must be a numeric vector of 2 numbers. Default c(5, 1).

relHeightDRBar

Relative heights of the scatter plot and the barplot within each subpanel. Must be a numeric vector of 2 numbers. Default c(10, 1).

mainNRow, mainNCol

Arrangement of the main plotting region, for number of rows and columns. Default NULL will be automatically handled by plot_grid.

legendNRow

Arrangement of the legend, number of rows. Default 1.

...

Additional graphic setting arguments passed to plotDimRed.

Value

ggplot object when only one feature (e.g. cluster variable, gene, factor) is set. List object when multiple of those are specified.

See also

Please refer to plotDimRed, .ggScatter, .ggplotLigerTheme for additional graphic setting

Examples

plotGroupClusterDimRed(pbmcPlot)
#>  Plotting feature "leiden_cluster_ctrl" on 600 cells
#>  Plotting feature "leiden_cluster_ctrl" on 600 cells ... done
#> 
#>  Plotting feature "leiden_cluster_stim" on 600 cells
#>  Plotting feature "leiden_cluster_stim" on 600 cells ... done
#>