Skip to contents

Quickly visualize expression gene-weighted density of one or more features based on Nebulosa.

Usage

plot_gw_density(
  data,
  features,
  reduction = "umap.harmony",
  size = 0.2,
  pal = "magma",
  ncol = 2,
  joint = FALSE,
  combine = TRUE,
  ...
)

Arguments

data

A Seurat object with a "harmony" reduction and UMAP computed on it.

features

Character vector of feature names to plot.

reduction

Name of the reduction to use for plotting (default "umap.harmony").

size

Size of the geom to be plotted (e.g. point size)

pal

Choose from Nebulosa's palettes, e.g. "magma", "inferno", "plasma", "viridis", "cividis".

ncol

Number of columns in the output layout (default 2).

joint

Return joint density plot? By default FALSE

combine

Passed to Nebulosa::plot_density().

...

Additional arguments passed to Nebulosa::plot_density().

Value

A patchwork object arranging density plots in a grid.

Examples

if (FALSE) { # \dontrun{
# Assuming 'obj' is a Seurat object with harmony UMAP
library(Seurat)
library(Nebulosa)
library(patchwork)
data <- SeuratObject::pbmc_small
plot_gw_density(data, c("CD3D", "CD3E"),
                reduction = "tsne", ncol = 2)
# joint density
plot_gw_density(data, c("CD3D", "CD3E"),
                reduction = "tsne",
                joint = TRUE, combine = FALSE)
} # }