Skip to contents

# density plot of marker expression in cell populations grouped by a meta variable

Source: `R/data_visualization.R`
`plot_marker_density.Rd`

`plot_marker_density()` plots the density distribution of expression for cell populations. Each line indicates distribution for one level in group_var.

## Usage

    plot_marker_density(
      fcd,
      marker,
      expr_slot = "orig",
      cluster_slot,
      cluster_var,
      cluster_to_show = NULL,
      group_var,
      facet_var = NULL,
      facet_ncol = 5,
      color_palette = cluster_palette
    )

## Arguments

fcd

  flow cytometry data set, that has been subjected to clustering or cell type label prediction with cyCONDOR

marker

  vector of characters indicating which features of the expression matrix should be plotted.

expr_slot

  expr_slot from which to take marker expression values, default is "orig". Corrected input data should be handled cautiously.

cluster_slot

  string specifying which clustering slot to use to find variable specified in cluster_var

cluster_var

  string specifying variable name in cluster_slot that identifies cell population labels to be used (e.g. clusters, metaclusters or predicted labels).

cluster_to_show

  (optional) vector of strings indicating levels in cluster_var that should be included for plotting.

group_var

  string indicating variable name in cell_anno for which density distributions get calculated.

facet_var

  (optional) string indicating variable name in cell_anno that should be used to facet the plots by a meta variable.

facet_ncol

  numeric, number of columns used for faceting.

color_palette

  vector of colors to be used to color the density lines

## Value

`plot_marker_density()` returns either one plot in case only one marker is provided via `marker` argument or a list of plots, if several markers are requested.

## Details

plot_marker_density

The density plots are plotted with default parameters of ggplot2's `geom_density`.