Skip to contents

# plot_confusion_HM

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

`plot_confusion_HM()` generates a heatmap showing the contribution of each group_var to a cell population after normalizing all levels in group_var to the same cell numbers.

## Usage

    plot_confusion_HM(
      fcd,
      cluster_slot,
      cluster_var,
      group_var,
      numeric = FALSE,
      size = 15,
      title = "Confusion matrix",
      cluster_cols = FALSE,
      cluster_rows = FALSE
    )

## Arguments

fcd

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

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 to calculate the confusion.

group_var

  string indicating variable name in cell_anno that should be used to calculate the relative contribution to the variable specified in cluster_var.

numeric

  logical, indicating if levels in cluster_var should be ordered in ascending numerical order.

size

  size of the individual squares and font

title

  character string, title of the plot.

cluster_cols

  logical indicating if columns should be clustered (default: FALSE)

cluster_rows

  logical indicating if rows should be clustered (default: FALSE)

## Value

`plot_confusion_HM()` first calculates cell counts for each combination of group_var and cell population and normalizes the counts to a total of 1000 cells per group_var. Afterwards the percentage of cells coming from each level in group_var is calculated per cell population. The normalization of counts corrects the visualization for differences in total cells (events) measured per group_var.

## Details

plot_confusion_HM