scrnatools.plotting.gene_density_plot
- scrnatools.plotting.gene_density_plot(adata: AnnData, gene_list: List[str], data_loc: str = 'X', thresh: int = 1, latent_rep: str = 'X_umap', est_settings=None, cmap: str = 'magma', s: int | None = None, ncols: int = 3, figsize: Tuple[int] = (3, 3), title: str | None = None, save_path: str | None = None, dpi: int = 300)[source]
Plots the density of expression of genes on an embedding.
- Parameters:
adata (AnnData) – The dataset containing the gene expression and cell data.
gene_list (List[str]) – A list of genes to plot.
data_loc (str, optional) – The location of the expression data to use for density calculations, can be a layer in ‘adata.layers’ or ‘X’ to use the data stored in adata.X. Defaults to “X”.
thresh (int, optional) – Kernel density threshold. Defaults to 1.
latent_rep (str, optional) – The 2D representation to plot gene expression for each cell on. Defaults to “X_umap”.
est_settings (optional) – Custom settings for the kernel density estimator. Defaults to None.
cmap (str, optional) – The pyplot colormap to use for plotting. Defaults to “magma”.
s (int, optional) – The size of data points to plot. Defaults to None.
ncols (int, optional) – The number of columns in the figure. Defaults to 3.
figsize (Tuple[int], optional) – The dimensions of each subplot for a single gene. Defaults to (3, 3).
title (str, optional) – The title of the figure. Defaults to None.
save_path (str, optional) – The path to save the figure. Defaults to None.
dpi (int, optional) – The resolution of the saved image. Defaults to 300.
- Raises:
ValueError – If the ‘data_loc’ provided is not ‘X’ or a valid layer in ‘adata.layers’