# scanpy.pl.embedding_density¶

scanpy.pl.embedding_density(adata, basis, key, *, group=None, color_map='YlOrRd', bg_dotsize=80, fg_dotsize=180, vmax=1, vmin=0, save=None, **kwargs)

Plot the density of cells in an embedding (per condition)

Plots the gaussian kernel density estimates (over condition) from the sc.tl.embedding_density() output.

This function was written by Sophie Tritschler and implemented into Scanpy by Malte Luecken.

The annotated data matrix.

basis

The embedding over which the density was calculated. This embedded representation should be found in adata.obsm['X_[basis]'].

key

Name of the .obs covariate that contains the density estimates

group

The category in the categorical observation annotation to be plotted. For example, ‘G1’ in the cell cycle ‘phase’ covariate.

color_map

Matplolib color map to use for density plotting.

bg_dotsize

Dot size for background data points not in the group.

fg_dotsize

Dot size for foreground data points in the group.

vmax

Density that corresponds to color bar maximum.

vmin

Density that corresponds to color bar minimum.

show

Show the plot, do not return axis.

save

If True or a str, save the figure. A string is appended to the default filename. Infer the filetype if ending on {‘.pdf’, ‘.png’, ‘.svg’}.

ax

A matplotlib axes object. Only works if plotting a single component.

>>> adata = sc.datasets.pbmc68k_reduced()
`