scanpy.pl.rank_genes_groups_dotplot

scanpy.pl.rank_genes_groups_dotplot(adata, groups=None, n_genes=10, groupby=None, values_to_plot=None, min_logfoldchange=None, key=None, show=None, save=None, return_fig=False, **kwds)
../_images/scanpy.pl.rank_genes_groups_dotplot.png

Plot ranking of genes using dotplot plot (see dotplot())

Parameters
adata : AnnDataAnnData

Annotated data matrix.

groups : str, Sequence[str], NoneUnion[str, Sequence[str], None] (default: None)

The groups for which to show the gene ranking.

n_genes : intint (default: 10)

Number of genes to show.

groupby : str, NoneOptional[str] (default: None)

The key of the observation grouping to consider. By default, the groupby is chosen from the rank genes groups parameter but other groupby options can be used. It is expected that groupby is a categorical. If groupby is not a categorical observation, it would be subdivided into num_categories (see dotplot()).

values_to_plot : {‘scores’, ‘logfoldchanges’, ‘pvals’, ‘pvals_adj’, ‘log10_pvals’, ‘log10_pvals_adj’}, NoneOptional[Literal[‘scores’, ‘logfoldchanges’, ‘pvals’, ‘pvals_adj’, ‘log10_pvals’, ‘log10_pvals_adj’]] (default: None)

The mean gene values are plotted by default. Alternatively, any other values computed by sc.rank_genes_groups can be plotted. For example log fold change or p-value.

min_logfoldchange : float, NoneOptional[float] (default: None)

Value to filter genes in groups if their logfoldchange is less than the min_logfoldchange

key : str, NoneOptional[str] (default: None)

Key used to store the ranking results in adata.uns.

show : bool, NoneOptional[bool] (default: None)

Show the plot, do not return axis.

save : bool, NoneOptional[bool] (default: None)

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.

return_fig : bool, NoneOptional[bool] (default: False)

Returns DotPlot object. Useful for fine-tuning the plot. Takes precedence over show=False.

**kwds

Are passed to dotplot().

Returns

If return_fig is True, returns a DotPlot object, else if show is false, return axes dict

Examples

>>> import scanpy as sc
>>> adata = sc.datasets.pbmc68k_reduced()
>>> sc.tl.rank_genes_groups(adata, 'bulk_labels', n_genes=adata.raw.shape[1])

Plot logfoldchanges instead of gene expression. In this case a diverging colormap like bwr or seismic works better. To center the colormap in zero, the minimum and maximum values to plot are set to -4 and 4 respectively. Also, only genes with a log fold change of 3 or more are shown. >>> sc.pl.rank_genes_groups_dotplot(adata, … n_genes=4, values_to_plot=”logfoldchanges”, cmap=’bwr’, … vmin=-4, vmax=4, min_logfoldchange=3, colorbar_title=’log fold change’)