plot_densities {distinct} | R Documentation

## Plot sample-specific densities.

### Description

`plot_densities` returns a `ggplot` object with the sample-specific density estimates, for a specified cluster and gene.

### Usage

    plot_densities(
      x,
      name_assays_expression = "logcounts",
      name_cluster = "cluster_id",
      name_sample = "sample_id",
      name_group = "group_id",
      cluster,
      gene,
      group_level = FALSE,
      adjust = 1,
      size = 0.75
    )

### Arguments

`x` | a `SummarizedExperiment` or a `SingleCellExperiment` object.
`name_assays_expression` | a character ("logcounts" by default), indicating the name of the assays(x) element which stores the expression data (i.e., assays(x)$name_assays_expression). We strongly encourage using normalized data, such as counts per million (CPM) or log-CPM.
`name_cluster` | a character ("cluster_id" by default), indicating the name of the colData(x) element which stores the cluster id of each cell (i.e., colData(x)$name_colData_cluster).
`name_sample` | a character ("sample_id" by default), indicating the name of the colData(x) element which stores the sample id of each cell (i.e., colData(x)$name_colData_sample).
`name_group` | a character ("group_id" by default), indicating the name of the colData(x) element which stores the group id of each cell (i.e., colData(x)$name_colData_group).
`cluster` | a character, indicating the name of the cluster to plot.
`gene` | a character, indicating the name of the gene to plot.
`group_level` | a logical, indicating whether to plot group-level (if TRUE) or sample-level curves (if FALSE).
`adjust` | a numeric, representing a multiplicate bandwidth adjustment, argument passed to `stat_density`.
`size` | a numeric argument defining the width of lines, passed to `stat_density`.

### Value

A `ggplot` object.

### Author(s)

Simone Tiberi simone.tiberi@uzh.ch

### See Also

`distinct_test`, `plot_cdfs`

### Examples

    data("Kang_subset", package = "distinct")
    Kang_subset

    plot_densities(x = Kang_subset,
                   gene = "ISG15",
                   cluster = "Dendritic cells",
                   name_assays_expression = "logcounts",
                   name_cluster = "cell",
                   name_sample = "sample_id",
                   name_group = "stim")

[Package distinct version 1.4.1 Index]